gpt4 book ai didi

php - 这个sql代码有什么问题?

转载 作者:可可西里 更新时间:2023-11-01 07:48:28 25 4
gpt4 key购买 nike

如果我删除行 condition=\''.$this->condition.'\', 它会起作用。

如果我放在那里,会出现以下错误消息:

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 'condition='unknown', promotional='0', website='0', quantity='1', ' at line 7

mysql_query('UPDATE products SET 
name = \''.$this->name.'\',
description = \''.$this->description.'\',
brand = \''.$this->brand.'\',
model = \''.$this->model.'\',
price=\''.$this->price.'\',
condition=\''.$this->condition.'\',
promotional=\''.$this->promotional.'\',
website=\''.$this->website.'\',
quantity=\''.$this->quantity.'\',
service=\''.$this->service.'\'
WHERE id = \''.$this->id.'\' '

最佳答案

CONDITIONreserved mysql keyword .您必须将其括在反引号中:

`condition`=\''.$this->condition.'\', 

关于php - 这个sql代码有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6877910/

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