[英]What's wrong with this sql code?
如果我刪除行condition=\\''.$this->condition.'\\',
它可以工作。
如果我在那里,會出現以下錯誤消息:
您的SQL語法有錯誤; 查看與您的MySQL服務器版本對應的手冊,以便在'condition ='unknown',promotional ='0',website ='0',quantity ='1','在第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.'\' '
CONDITION
是一個保留的mysql關鍵字 。 你必須用反引號括起來:
`condition`=\''.$this->condition.'\',
您必須重命名condition
列。 請參閱保留的MySQL關鍵字表
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.