gpt4 book ai didi

php - 插入错误 MySQL/PHP

转载 作者:行者123 更新时间:2023-12-01 00:02:55 25 4
gpt4 key购买 nike

我收到这个错误:

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 (total, addy, cc) VALUES ('798' , '123 sadf' , '12124123')' at line 1

$total = addslashes(($_SESSION['total']));

$addy = addslashes(($_POST['addy']));

$cc = addslashes(($_POST['cc']));

echo "$total";

echo "$addy";

echo "$cc";

mysql_query("INSERT INTO order (total, addy, cc) VALUES ('$total' , '$addy' , '$cc')") or die(mysql_error());

我该如何解决这个问题?

最佳答案

在 SQL 中,order 是一个保留字。而是使用:

INSERT INTO `order`

关于php - 插入错误 MySQL/PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2910194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com