Home > Backend Development > PHP Tutorial > Unknown column 'name' in 'field list ; please help me !解决方法

Unknown column 'name' in 'field list ; please help me !解决方法

WBOY
Release: 2016-06-13 12:12:17
Original
1619 people have browsed it

Unknown column 'name' in 'field list ; please help me !!

本帖最后由 neuuuuuuu 于 2014-12-20 19:20:25 编辑
<br /><br /><?php<br /> <br /><br />$conn = mysql_connect("localhost", "root", "");<br />/*<br />echo"$stm"<br />*/<br />if (!$conn)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br />mysql_select_db("root",$conn)or die(mysql_error());<br />mysql_query('set names GB2312');<br /><br />$sql="insert into shopsystem(name,tel,email,QQ,addr,sex,brandname,commoditybrand,productID,ordername,shopname,shopaddr,invoicenumber,purchasingdate)<br />values('$name','$tel','$email','$QQ','$addr','$sex','$brandname','$commoditybrand','$productID','$ordername','$shopname','$shopaddr','$invoicenumber','$purchasingdate')";<br />if (!mysql_query($sql,$conn))<br />  {<br />  die ('Error: ' . mysql_error());<br />  }<br /><br />mysql_close($conn);<br />?><br /><br />
Copy after login


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 前加个空格试试。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template