SQLSTATE [42000]错误

时间:2014-02-25 14:45:19

标签: php sql

无法弄清楚这个查询出错的地方......

收到此错误:

{"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'])));

谢谢!

1 个答案:

答案 0 :(得分:2)

您应该向desc列名称添加反引号。这是一个保留字(ORDER BY vrm DESC)。