我有一段总是返回错误的 SQL
,但我找不到它返回错误的原因。我已经连接到数据库没有错误。我正在运行 PHP 5.2.17
、MySQL 5.5.25a
和 Apache 2.4.2。
SQL
:
DELETE FROM mail WHERE to=1
错误:
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 'to=1' at line 1
最佳答案
TO
是 reserved word ,你需要使用反引号:
DELETE FROM mail WHERE `to` = 1
关于带有 DELETE FROM 的 MySQL 语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11515057/