#1064 - 您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以获得正确的语法

Rem*_*scu 2 php mysql mysql-error-1064

我想使用以下脚本创建一个表:

mysql_query("create table `".$mysql_table_prefix."query_log` (
    query varchar(255),
    time timestamp(14),
    elapsed float(2),
    results int, 
    key query_key(query)
)");
Run Code Online (Sandbox Code Playgroud)

它给了我这个错误:

#1064 - 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 'mysql_query("create table `".$mysql_table_prefix."query_log` ( query varchar(25' at line 1
Run Code Online (Sandbox Code Playgroud)

编辑:我在phpMyAdmin中使用了sql选项卡

我能做什么?

Aur*_*osa 5

我看到的第一个错误是timestamp没有长度.所以这一行:

time timestamp(14),
Run Code Online (Sandbox Code Playgroud)

应该是这样的:

time timestamp,
Run Code Online (Sandbox Code Playgroud)