WordPress is not creating table in database after activating plugin,
I struggled with this a long time! Can anyone help me? My plugin is not creating a database table once activated. The following code is in the main plugin file.
function woocq_activate() {
global $wpdb;
$table_name = $wpdb-prefix . 'woocq';
$sql = CREATE TABLE $table_name (
id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,
name VARCHAR NOT NULL,
message TEXT NOT NULL,
question_id INT NOT NULL,
product_id INT DEFAULT NULL,
timestamp BIGINT NOT NULL,
PRIMARY KEY (id)
);;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql );
}
register_activation_hook( __FILE__, 'woocq_activate' );
Thank you in advance!