欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

You have an error in your SQL syntax,该怎么解决

程序员文章站 2024-01-31 20:26:40
...
You have an error in your SQL syntax
function _query($_sql) {
if (!$_result = mysql_query($_sql)) {
exit('SQL执行失败'.mysql_error());
}
return $_result;
}
function _fetch_array($_sql) {
return mysql_fetch_array($this->_query($_sql),MYSQL_ASSOC);
}
function _is_repeat($_sql,$_info) {
if ($this->_fetch_array($_sql)) {
_alert_back($_info);
}
}

_is_repeat(
"SELECT commodity_name FROM commodity WHERE commodity_name='{$_goods['commodity_name']}' LIMIT 1",
'对不起,此商品已经存在'
);
$DB->_query(
"INSERT INTO commodity(
commodity_name,
Sale_Address,
Seller,
Production_Address,
Company,
permit_number,
content
)
VALUES(
'{$_goods['commodity_name']}' ,
'{$_goods['Sale_Address']}',
'{$_goods['Seller']}',
'{$_goods['Production_Address']}',
'{$_goods['Company']}',
'{$_goods['permit_number']}',
'{$_goods['content']}',

)"

);



?>

我的程序运行出现错误: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 ')' 。代码太多,我只把与问题相关的代码贴了出来,如果看不出来我可以发全部代码。希望各位大神帮帮忙,我还是个新手,希望能说的通俗一点,谢谢

------解决方案--------------------
'{$_goods['content']}', 这里多了个逗号
You have an error in your SQL syntax,该怎么解决

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频