This question already has an answer here:
Syntax error due to using a reserved word as a table or column name in MySQL
(1个答案)
5年前关闭。
我有几行代码可以生成关于OpenCart 1.4.9中优惠券的报告,但是我无法克服这个错误:
其余代码可以找到here。
(1个答案)
5年前关闭。
我有几行代码可以生成关于OpenCart 1.4.9中优惠券的报告,但是我无法克服这个错误:
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
'order where coupon_id = 16' at line 1.
$getcouponinfo1 = mysql_query("select * from order where coupon_id = $coupon_id")
or die(mysql_error());
其余代码可以找到here。
最佳答案
order
是SQL中的一个关键字,您需要引用该表名。
select * from `order` where ...
关于php - sql语法中的奇数错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9546542/