The code and steps for creating a new data table in WordPress
function weixin_robot_texts_crate_table() { global $wpdb; $table_name = $wpdb->prefix . "weixin_robot_texts"; if($wpdb->get_var("show tables like '$table_name'") != $weixin_robot_texts_table) { $sql = "CREATE TABLE " . $table_name . " ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `keyword` varchar(255) CHARACTER SET utf8 NOT NULL, `reply` text CHARACTER SET utf8 NOT NULL, `status` int(1) NOT NULL DEFAULT '1', `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `keyword` (`keyword`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; "; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); }} register_activation_hook( __FILE__,'weixin_robot_texts_crate_table');
$charset_collate = $wpdb->get_charset_collate();
function my_table_crate_table() { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . "my_table_name"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `keyword` varchar(255) CHARACTER SET utf8 NOT NULL, `reply` text CHARACTER SET utf8 NOT NULL, `status` int(1) NOT NULL DEFAULT '1', `time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `keyword` (`keyword`) ) '.$ charset_collate.'; "; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); }} register_activation_hook(__FILE__, 'my_table_crate_table');
Can't find a tutorial that can solve your problem?
-
Charging zblogphp template The 9th zblog enterprise theme of Tianxing Studio has its own form to submit email reminders, etc zero 2019-12-11 eleven thousand two hundred and seventy-seven Price: four hundred and sixty-eight Online purchase -
Charging zblogphp template Tianxing Studio ppt download template is suitable for sites with resources to sell vips one 2019-10-03 nine thousand eight hundred and thirty-six Price: one hundred and ninety-nine Online purchase -
Wordpress template Tianxing Studio wordpress download station theme is applicable to software/app/game and other download stations zero 2022-05-06 five thousand four hundred and eighty-three Price: three hundred and fifty-five Online purchase -
Charging zblogphp template Tianxing Studio zblogphp enterprise theme 6 Self configurable atmosphere zblog enterprise theme two 2018-06-26 forty-four thousand nine hundred and eleven Price: two hundred and fifty-eight Online purchase
Related recommendations
welcome you Comment: Cancel Reply
-
Zblog enterprise theme -
Zblog image theme -
Zblog resource topic -
Zblog CMS topic -
Wordpress template -
Zblog video theme -
Zblog Taobao guest theme -
Zblog navigation topic
Select a theme?
-
Latest articles -
Hot article ranking -
Most Comments
-
one Shopping activity on the official website of Tianxing Studio: unlimited number of times and amount of 20% discount coupons 04-17 -
two Tianxing Studio zblog pure blog theme vue3+applet dual version 03-19 -
three Error causes and solutions of introducing vant into vue3 project 03-12 -
four Tianxing Studio zblog encyclopedia theme can be matched with member plug-ins to realize knowledge payment profitability 03-06 -
five How does zblog intercept a summary with a specified number of words? Introduction to the custom interception method of zblog summary 02-29 -
six Tianxing Studio 2023 Double 11 Event: 50% discount coupons 11-05 -
seven Tencent Cloud 2023 Double 11 Activity: 2H2G3M lightweight server 88 new users for one year 11-05 -
eight AliCloud 2023 Double 11 Activity: 2-core 2G3M bandwidth ECS 99 yuan/year! 10-31 -
nine Tianxing Studio zblog free login paid reading plug-in supports Alipay WeChat payment Hupi Pepper payment 10-09
-
Label aggregation -
×1 Custom Template ×1 Zblog logic ×1 Free list ×1 Another shot ×1 A5 ×1 Win8 tablet ×1 Zblog free cms topic ×1 zblogphp1.3 ×1 Js Framework ×1 Wordpress network disk ×1 Zblog Download Template ×1 administrator account ×1 New article in zblog ×1 Back end configuration item ×1 Computer side theme ×1 Spicy Chicken Baidu ×1 Wordpress Top ×1 360 Browser ×1 Trojans ×1 Zblog topic
Latest comments
-
Tianxing Studio 03-21 Yes, it will be repaired in the next version Commented on: Tianxing Studio zblog pure blog theme vue3+applet dual version -
visitor 03-20 This template has multiple side-by-side pictures. No matter which picture you click, the first picture will be displayed. There is no carousel button, and you can only manually close it. System: win7+Firefox Commented on: Tianxing Studio zblog pure blog theme vue3+applet dual version -
Tianxing Studio 01-19 I don't understand. Do you want to create categories in batches? This is not considered by the theme of plug-ins Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration -
visitor 01-18 It is too troublesome to classify and set one by one. Can you add classification settings in the theme settings. Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration -
Tianxing Studio 01-16 I don't quite understand your requirements. Please contact our online qq2076496616 to provide the order number to specify your requirements Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration