This is the code below I am using to create a table when installing plugin. But, I tried many ways and for some reason it is not working. Is there any other efficient way of doing this? Please Help, thanks in Advanced
global $wpdb;
function creating_order_tables() {
global $wpdb;
$ptbd_table_name = $wpdb->prefix . 'printtextbd_order';
if ($wpdb->get_var("SHOW TABLES LIKE '". $ptbd_table_name ."'" ) != $ptbd_table_name ) {
$sql = 'CREATE TABLE exone(
customer_id INT(20) AUTO_INCREMENT,
customer_name VARCHAR(255),
order_type VARCHAR(255),
choosen_template VARCHAR(255),
order_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(customer_id))';
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
echo "hello";
}
}
register_activation_hook(__FILE__, 'creating_order_tables');