Hi,
It's been a week since I have been struggling with this problem. I have a plugin that should create its own custom database tables.
Here is a snippet of my code
global $wpdb;
function create_load_table(){
$table_name = $wpdb->prefix.'name';
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name){
$create_name_table_query = "CREATE TABLE ".$table_name."(
Name_Key int(8) NOT NULL AUTO_INCREMENT,
Firstname char(25) NOT NULL,
Middlename char(25) NOT NULL,
Lastname char(25) NOT NULL,
Birthday date NOT NULL,
PRIMARY KEY ('Name_Key')
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($create_name_table_query);
}
register_activation_hook(__FILE__,'create_name_table');
It get's activated whenever I click the activate option, but when I check the database, no tables are created. I am testing this one on localhost before I deploy to our actual webserver.
Can anyone tell me what I am doing wrong. I have tried a lot of things, and it's been driving me nuts..
Any help would gladly be appreciated.
Thanks in anticipation,
Loken