I am having a problem with my plugin that is suppose to create a table in the WordPress database when it is activated. My current code is as follows:
register_activation_hook(__FILE__, 'wp_table_install');
function wp_table_install(){
global $wpdb;
global $db_version;
$sql ="CREATE TABLE IF NOT EXISTS 'st_support_tickets'
('id' mediumint(8) unsigned NOT NULL auto_increment,
'ticket_id' varchar(36) NOT NULL,
'ticket_user_id' varchar(36) NOT NULL,
'ticket_description' TEXT default NULL,
'ticket_priority' varchar(255) default NULL,
'ticket_status' varchar(255) default NULL,
'ticket_type' varchar(255) default 'Private',
PRIMARY KEY ('id'))
AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS 'st_support_priorities'
('id' mediumint(8) unsigned NOT NULL auto_increment,
'ticket_user_id' varchar(36) NOT NULL,
PRIMARY KEY ('id'))
AUTO_INCREMENT=1;
";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
add_option("db_version", $db_version);
}
What is stopping these tables from being created? Is it the sql query or the syntax or what?