0

hi to all m using the following query:

$rows = mysql_query("UPDATE admin SET create ='".$close."' WHERE id=".$id) or die(mysql_error());

but i got the following 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 'create ='0' WHERE id=6' at line 1

help me plz in this regard thnx in advance

4

2 回答 2

8

create是一个保留字。你必须逃避它:

UPDATE admin SET `create`=...
                 ^-     ^-
于 2012-10-12T14:49:59.347 回答
2

您需要使用反引号 ( `) 正确引用您的查询,因为这create是 MySQL 中的保留关键字。

$rows = mysql_query("UPDATE admin SET `create` = '".$close."' WHERE `id` = ".$id) or die(mysql_error());

我强烈推荐使用PDO

于 2012-10-12T14:49:54.920 回答