当前位置:Gxlcms > PHP教程 > Unknowncolumn'name'in'fieldlist;pleasehelpme!解决方法

Unknowncolumn'name'in'fieldlist;pleasehelpme!解决方法

时间:2021-07-01 10:21:17 帮助过:17人阅读

Unknown column 'name' in 'field list ; please help me !!
本帖最后由 neuuuuuuu 于 2014-12-20 19:20:25 编辑





$conn = mysql_connect("localhost", "root", "");
/*
echo"$stm"
*/
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("root",$conn)or die(mysql_error());
mysql_query('set names GB2312');

$sql="insert into shopsystem(name,tel,email,QQ,addr,sex,brandname,commoditybrand,productID,ordername,shopname,shopaddr,invoicenumber,purchasingdate)
values('$name','$tel','$email','$QQ','$addr','$sex','$brandname','$commoditybrand','$productID','$ordername','$shopname','$shopaddr','$invoicenumber','$purchasingdate')";
if (!mysql_query($sql,$conn))
{
die ('Error: ' . mysql_error());
}

mysql_close($conn);
?>



Error: 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 '')' at line 2
------解决思路----------------------
错误提示有两个?
echo $sql; 贴出结果看看。
------解决思路----------------------
Unknown column 'name' in 'field list ;
name 字段不存在,请检查

Error: 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 '')' at line 2

$sql="insert into shopsystem(name,tel,email,QQ,addr,sex,brandname,commoditybrand,productID,ordername,shopname,shopaddr,invoicenumber,purchasingdate)
values('$name','$tel','$email','$QQ','$addr','$sex','$brandname','$commoditybrand','$productID','$ordername','$shopname','$shopaddr','$invoicenumber','$purchasingdate')";
if (!mysql_query($sql,$conn))

values 前加个空格试试。

人气教程排行