2015-04-23 76 views
1

在數據庫中正確創建的所有表格中,下面的表格讓我發狂,不能得到它!MySQL錯誤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)的引用;也沒有工作。

+2

'reads'是在MySQL https://dev.mysql.com/doc/refman/5.5/en/reserved-words.html –

回答

2

readsreserved keyword in MySQL,需要通過反引號進行轉義。

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

大部分有義務克林斯曼保留字, –