1

谁能弄清楚我在这里做错了什么?错误信息相当模糊......

16-Apr-2012 17:36:42] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 24 for query CREATE TABLE wp_psadata(
    id INTEGER(10) UNSIGNED AUTO_INCREMENT,
    date_entered TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    submitter_name VARCHAR(255),
    submitter_email VARCHAR(255),
    submitter_phone VARCHAR(255),
    event_name VARCHAR(255),
    location_name VARCHAR(255),
    address VARCHAR(255),
    city VARCHAR(255),
    state VARCHAR(255),
    zipcode VARCHAR(5),
    phone VARCHAR(255),
    email VARCHAR(255),
    uri VARCHAR(255),
    event_start_date DATE,
    event_start_time TIME,
    event_end_date DATE,
    event_end_time TIME,
    recurs_on_dow TINYINT,
    description VARCHAR(4000),
    comments VARCHAR(4000), 
    active TINYINT DEFAULT 1,
    wants_reach_at_event TINYINT DEFAULT 0 made by activate_plugin, do_action, call_user_func_array, psa_activate, dbDelta

使用:SQLite 版本 2.8.17 - 3.7.4 / PHP 版本 5.3.6

谢谢!

编辑:

这是我在 PHP 中的实际代码。上面的代码来自日志,所以它可能会遗漏一些东西:

$sql = 'CREATE TABLE '. $table_name . '(
    id INTEGER(10) UNSIGNED AUTO_INCREMENT,
    date_entered TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    submitter_name VARCHAR(255),
    submitter_email VARCHAR(255),
    submitter_phone VARCHAR(255),
    event_name VARCHAR(255),
    location_name VARCHAR(255),
    address VARCHAR(255),
    city VARCHAR(255),
    state VARCHAR(255),
    zipcode VARCHAR(5),
    phone VARCHAR(255),
    email VARCHAR(255),
    uri VARCHAR(255),
    event_start_date DATE,
    event_start_time TIME,
    event_end_date DATE,
    event_end_time TIME,
    recurs_on_dow TINYINT,
    description VARCHAR(4000),
    comments VARCHAR(4000), 
    active TINYINT DEFAULT 1,
    wants_reach_at_event TINYINT DEFAULT 0;
    PRIMARY KEY  (ID) )';
4

1 回答 1

4

编辑:

此行后面有一个分号,它是 mysql 语句分隔符。

wants_reach_at_event TINYINT DEFAULT 0; <--

你可能打算让它成为一个逗号,

wants_reach_at_event TINYINT DEFAULT 0,
PRIMARY KEY  (ID) )';
于 2012-04-16T17:48:46.763 回答