dbdelta doesn’t work
-
Quite a simple problem really:
function create_links_table(){ //Create link table global $wpdb; $table_name = $wpdb->prefix . "fim_links"; if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( order mediumint(9) NOT NULL AUTO_INCREMENT, href text DEFAULT '#' NOT NULL, id text DEFAULT '0' NOT NULL, block mediumint(9) DEFAULT '1' NOT NULL, PRIMARY KEY (order) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); echo "DBINFO:"; $result = dbDelta($sql); var_dump($result); $sql = "INSERT INTO " . $table_name . " (href, id) " . "VALUES ('https://crytekuk.info','link_example')"; $wpdb->query($sql); } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘dbdelta doesn’t work’ is closed to new replies.