我的查询代码是:
$query = mysql_query("UPDATE books SET read = 'y' WHERE id = 2") or die(mysql_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 'read = 'y' WHERE id = 2' at line 1
答案 0 :(得分:3)
read
是MySQL中的保留关键字。用反引号括起来:
UPDATE books SET `read` = 'y' WHERE id = '2'
有关保留关键字的列表,请参阅http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html。