2014-02-25 118 views
0

不能找出在這個查詢是怎麼了......SQLSTATE [42000]錯誤

收到此錯誤:

{"databaseException":"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 'desc) \n VALUES (1, array)' at line 1" 

從該查詢

$statement = $db->prepare(
"INSERT INTO `descriptions` (vrm, desc) VALUES (:vrm, :description)" 
); 

if ($statement->execute(array(
':vrm' => '1', 
':description' => $_POST['desc']))); 

謝謝!

回答

2

您應該向desc列名添加反引號。它是一個保留字(ORDER BY vrm DESC)。

+0

啊以爲是那個!謝謝! – Lovelock

相關問題