MySQL ERROR 1064无法弄明白

时间:2015-04-23 09:28:35

标签: php mysql database mysql-error-1064

在数据库中正确创建的所有表中,下面的表格让我发疯,无法得到它!

我非常感谢您帮助解读错误。

"DROP TABLE IF EXISTS `content_pages`;", 

"CREATE TABLE content_pages (
  id int(10) NOT NULL auto_increment,
  category int(10) NOT NULL default '0',
  title varchar(200) NOT NULL default '',
  page blob NOT NULL,
  page_type varchar(20) NOT NULL default '',
  display_in_theme int(5) NOT NULL default '0',
  html_header int(5) NOT NULL default '0',
  reads int(10) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE = MyISAM;",

错误报告:

Database Queries
Query: CREATE TABLE content_pages ( id int(10) NOT NULL auto_increment, category int(10) NOT NULL default '0', title varchar(200) NOT NULL default '', page blob NOT NULL, page_type varchar(20) NOT NULL default '', display_in_theme int NOT NULL default '0', html_header int NOT NULL default '0', reads int NOT NULL default '0', PRIMARY KEY (id) ) ENGINE = MyISAM;
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 'reads int NOT NULL default '0', PRIMARY KEY (id) ) ENGINE = MyISAM' at line 9

注:

我尝试删除int(5)和int(10)引用;也没用。

1 个答案:

答案 0 :(得分:2)

readsreserved keyword in MySQL,需要通过反引号进行转义。

`reads` int(10) NOT NULL default 0,