Hi i want to know can i create two tables
while installing my custom plugin. This is the way i am creating the tables
in database
function wnm_install(){
global $wpdb;
global $wnm_db_version;
$sms_table = $wpdb->prefix . "smsfactory";
if($wpdb->get_var("show tables like '". $sms_table . "'") != $sms_table){
$sql_sms_table = "CREATE TABLE ". $sms_table . " (
SfID int(11) NOT NULL AUTO_INCREMENT,
sf_name varchar(128) NOT NULL,
start_duration date NOT NULL,
end_duration date NOT NULL,
activity varchar(500) NOT NULL,
survey_settings varchar(50) NOT NULL,
`limit` varchar(50) NOT NULL,
goal varchar(100) DEFAULT NULL,
PRIMARY KEY (SfID)
) ";
}
$sms_message_table = $wpdb->prefix . "smsfactorymessagetemplate";
if($wpdb->get_var("show tables like '". $sms_message_table . "'") != $sms_message_table){
$sql = "CREATE TABLE ". $sms_message_table . " (
sfID int(11) NOT NULL AUTO_INCREMENT,
sftemplate_name varchar(256) NOT NULL,
sftemplate_type varchar(128) NOT NULL,
PRIMARY KEY (sfID)
) ";
}
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
add_option("wnm_db_version", $wnm_db_version);
}
Now problem with this code is it creates the second table and skip the first one so please tell me any solution for this