I Tried to create table in database with the help of register_activation_hook() but its not working....
function my_plugin_activation(){
global $wpdb , $table_prefix;
$wp_emp = $table_prefix.'emp';
$q = "CREATE TABLE IF NOT EXISTS` $wp_emp` (`id` INT NOT NULL , `name` VARCHAR(50) NOT NULL ,
`Email` VARCHAR(100) NOT NULL , `status` VARCHAR NOT NULL ) ENGINE = InnoDB;";
$wpdb -> query($q);
}
You need to add
register_activation_hookin your plugin file to run any script during the activation of your plugin and call thedbDeltafunction to execute thesqlcommand and includewp-admin/includes/upgrade.php. For example: