这个SQL语法有什么问题


Whats wrong with this sql syntax?

$sql3 = 
    "INSERT INTO `orders` (cid, eid, order, date_ordered, date_called, status) 
  VALUES ('$cid', '$eid', '$order', '$date_ordered', '$date_called', '$status')";

错误是:

错误:您的 SQL 语法有错误;请查看与您的 MySQL 服务器版本对应的手册,了解在"order, date_ordered, date_called, status"附近使用的正确语法值(第 1 行的值("0012"、"0"、"gydfhtfhjghj"、")

ORDER是一个保留字。因此,您可以使用反引号来转义它:

$sql3 = 
"INSERT INTO `orders` (cid, eid, `order`, date_ordered, date_called, status) 
 VALUES ('$cid', '$eid', '$order', '$date_ordered', '$date_called', '$status')";

ORDER 是一个保留关键字。使用不同的名称或将其括在反引号中(它们显然不称为引号)。

`order`