function create_custom_table()
{
global $table_prefix, $wpdb;
$tblname = \'custom_plugin\';
$wp_track_table = $table_prefix . "$tblname ";
#Check to see if the table exists already, if not, then create it
if($wpdb->get_var( "show tables like \'$wp_track_table\'" ) != $wp_track_table)
{
$sql = "CREATE TABLE `wp_custom_plugin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` varchar(100) NOT NULL,
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ";
require_once( ABSPATH . \'/wp-admin/includes/upgrade.php\' );
dbDelta($sql);
}
}
register_activation_hook( __FILE__, \'create_custom_table\' );