缺少逗号结尾phone varchar(10) NOT NULL
第行,在将创建的表之后添加逗号。我已经测试过了https://prnt.sc/qgqmog
function lapizzeria_database() {
global $wpdb;
global $lapizzeria_db_version;
$lapizzeria_db_version = "1.0";
$table = $wpdb->prefix . \'reservation\';
$charset_collate = $wpdb->get_charset_collate();
//SQL Statement
$sql = "CREATE TABLE $table (
id mediumint(9) NOT NULL AUTO_INCREMENT,
name varchar(50) NOT NULL,
date datetime NOT NULL,
email varchar(50) DEFAULT \'\' NOT NULL,
phone varchar(10) NOT NULL,
message longtext NOT NULL,
PRIMARY KEY (id)
) $charset_collate; ";
require_once(ABSPATH . \'wp-admin/includes/upgrade.php\');
dbDelta($sql);
}
add_action(\'after_setup_theme\', \'lapizzeria_database\');