2012-08-09 175 views
3

當我嘗試執行下面的sql語句時,出現以下錯誤。MySql訪問衝突或語法錯誤

SQLSTATE[42000]: Syntax error or access violation: 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 'like, agree, favor, discriminator) VALUES ('5023fb89189df', 0, '2012-08-09 14:03' at line 1 

完整的SQL語句低於

INSERT INTO activity (id, hide_author, created, updated, access, location, disabled, created_ip, updated_ip, params, body, audit, hide_activity, author, owning_activity, like, agree, favor, discriminator) VALUES ('5023fa5a63d1b', NULL, '2012-08-09 13:58:50', '2012-08-09 13:58:50', NULL, NULL, 0, '192.168.1.1', NULL, NULL, 'Exactly, I would prefer to be able to defend myself when the unthinkable happens', NULL, 0, '50143c83e3f5a', '5023e63dafe18', 1, NULL, NULL, 'commentpost') 

我看不出有語法錯誤,但是也許你們可以給一些建議,以什麼樣的訪問衝突可能是原因。我應該尋找什麼?

回答

4

「Like」是SQL中的保留字。反引號。這是在您的計算機上的「1」旁邊的關鍵像這樣:

INSERT INTO activity (id, hide_author, created, updated, access, location, disabled, created_ip, updated_ip, params, body, audit, hide_activity, author, owning_activity, `like`, agree, favor, discriminator) VALUES ('5023fa5a63d1b', NULL, '2012-08-09 13:58:50', '2012-08-09 13:58:50', NULL, NULL, 0, '192.168.1.1', NULL, NULL, 'Exactly, I would prefer to be able to defend myself when the unthinkable happens', NULL, 0, '50143c83e3f5a', '5023e63dafe18', 1, NULL, NULL, 'commentpost') 
+0

嘿,感謝您的超快速響應。它看起來像我將不得不改變屬性的名稱。我通過教條做完這件事。除非你知道一種方法讓教條添加這些刻度? – Furyvore 2012-08-09 18:18:17

+1

如果您以任何方式更改字段名稱,我強烈建議您這樣做。恐怕我不熟悉教義,但不管如何,建議更改名稱。 – 2012-08-09 18:19:42

+0

謝謝,這完全解決了我的問題。 – Furyvore 2012-08-09 18:27:01

相關問題