gpt4 book ai didi

php - MySQLi 语法不一致错误

转载 作者:行者123 更新时间:2023-11-29 02:55:22 25 4
gpt4 key购买 nike

我正在尝试使用以下查询将数据输入到我的 MySQL 数据库中

UPDATE `Customer Table` SET `ID`=$ID, `First name`='$FirstName',`Last name`='$LastName',`Home phone number`=$HomePhoneNumber,`Mobile phone number`=$MobilePhoneNumber,`House number`=$HouseNumber,`House name`='$HouseName',`Street name`='$StreetName',`Town name`='$TownName',`Post code`='$PostCode' ,`Notes`='$Notes' WHERE ID=$ID

当我从一个 PHP 文件调用它时它工作正常,但当我从 API PHP 文件调用它时它不起作用。

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 '`House number`=0,`House name`='43',`Street name`='Westbury',`Town name`='We' at line 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 '`House number`=0,`House name`='3',`Street name`='Close',`Town name`='Thorn' at line 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 '`House number`=0,`House name`='flat',`Street name`='2 road',`Town ' at line 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 '`House number`=0,`House name`='39',`Street name`='valley',`Town name`='',`' at line 1

任何人都可以看到错误在哪里,因为我正在努力寻找它。据我所知,所有数据类型都是正确的。

提前致谢,卢克。

最佳答案

试试这个。您的变量 $MobilePhoneNumber 似乎包含其中的字符串部分,例如 +

"UPDATE `Customer Table` SET `ID` = '$ID', `First name` = '$FirstName',
`Last name`= '$LastName',`Home phone number`= '$HomePhoneNumber',
`Mobile phone number` = '$MobilePhoneNumber',`House number` = '$HouseNumber',
`House name`='$HouseName',`Street name`='$StreetName',`Town name`='$TownName',
`Post code`='$PostCode',`Notes`='$Notes' WHERE ID=$ID"

关于php - MySQLi 语法不一致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31206543/

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