Home  >  Article  >  Backend Development  >  = - 求大神 指导下 非常感谢 ~解决办法

= - 求大神 指导下 非常感谢 ~解决办法

WBOY
WBOYOriginal
2016-06-13 12:11:461041browse

= - 求大神 指导下 非常感谢 ~

<br /><?php<br /><br />echo "姓名:".$_POST['name']."<br/>";<br />// echo $_POST['price']."<br/>";	<br />// echo $_POST['type']."<br/>";	<br />// echo $_POST['name']."<br/>";	<br />echo "电话:". $_POST['tel']."<br/>";<br />echo "电邮:".$_POST['email']."<br/>";	<br />echo "QQ:".$_POST['QQ']."<br/>";<br />echo "地址:".$_POST['addr']."<br/>";<br />echo "性别:".$_POST['sex']."<br/>";<br />echo "商品名称:".$_POST['brandname']."<br/>";<br />echo "商品品牌:".$_POST['commoditybrand']."<br/>";<br />echo "商品编号:".$_POST['productID']."<br/>"; 	<br />echo "商品序号:".$_POST['ordername']."<br/>";<br />echo "商铺名称:".$_POST['shopname']."<br/>";<br />echo "商铺地址:".$_POST['shopaddr']."<br/>";<br />echo "发票编号:".$_POST['invoicenumber']."<br/>";<br />echo "购买日期:".$_POST['purchasingdate']."<br/>";<br /><br /><br />$dingdanhao = date("Y-m-dH-i-s");<br />$dingdanhao = str_replace("-","",$dingdanhao);<br />$dingdanhao .= rand(1000,2000);<br /><br />echo "保用编号:".  $dingdanhao;<br /><br /> <br />$name=$_POST['name'];<br />$tel=$_POST['tel'];<br />$email=$_POST['email'];<br />$QQ=$_POST['QQ'];<br />$sex=$_POST['sex'];<br />$brandname=$_POST['brandname'];<br />$commoditybrand=$_POST['commoditybrand'];<br />$productID=$_POST['productID']; <br />$ordername=$_POST['ordername'];<br />$shopname=$_POST['shopname'];<br />$shopaddr=$_POST['shopaddr'];<br />$invoicenumber=$_POST['invoicenumber'];<br />$purchasingdate=$_POST['purchasingdate'];<br /><br /><br />require_once("conn.php");<br />if(mysql_query("insert into name set <br /><br />name='$name',tel='$tel',email='$email',QQ='$QQ',sex='$sex',brandname='$brandname',commodity<br /><br />brand='$commoditybrand',productID='$productID',ordername='$ordername',shopname='$shopname',<br /><br />shopaddr='$shopaddr',invoicenumber='$invoicenumber',purchasingdate='$purchasingdate'",<br /><br />$conn)){<br />echo "添加成功!<a href='testmysql.php'>查看数据库</a>";<br />}<br /> else{<br />	echo '添加失败!';<br />}<br /><br />mysql_close($con);<br />?><br />

错误报告 如下 :
Notice: Undefined variable: con in D:\wamp\www\WWW\post.php on line 55
Call Stack


( ! ) Warning: mysql_close() expects parameter 1 to be resource, null given in D:\wamp\www\WWW\post.php on line 55

= - 求助 
------解决思路----------------------
mysql_close($con);改成mysql_close($conn);
------解决思路----------------------
$con 写错了,应该是$conn

你上面的程序有写的。
mysql_query("insert into name set 
 
name='$name',tel='$tel',email='$email',QQ='$QQ',sex='$sex',brandname='$brandname',commodity
 
brand='$commoditybrand',productID='$productID',ordername='$ordername',shopname='$shopname',
 
shopaddr='$shopaddr',invoicenumber='$invoicenumber',purchasingdate='$purchasingdate'",
 
$conn))

Statement:
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