当前位置:Gxlcms > PHP教程 > =-求大神指导下非常感谢~解决办法

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

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

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


echo "姓名:".$_POST['name']."
";
// echo $_POST['price']."
";
// echo $_POST['type']."
";
// echo $_POST['name']."
";
echo "电话:". $_POST['tel']."
";
echo "电邮:".$_POST['email']."
";
echo "QQ:".$_POST['QQ']."
";
echo "地址:".$_POST['addr']."
";
echo "性别:".$_POST['sex']."
";
echo "商品名称:".$_POST['brandname']."
";
echo "商品品牌:".$_POST['commoditybrand']."
";
echo "商品编号:".$_POST['productID']."
";
echo "商品序号:".$_POST['ordername']."
";
echo "商铺名称:".$_POST['shopname']."
";
echo "商铺地址:".$_POST['shopaddr']."
";
echo "发票编号:".$_POST['invoicenumber']."
";
echo "购买日期:".$_POST['purchasingdate']."
";


$dingdanhao = date("Y-m-dH-i-s");
$dingdanhao = str_replace("-","",$dingdanhao);
$dingdanhao .= rand(1000,2000);

echo "保用编号:". $dingdanhao;


$name=$_POST['name'];
$tel=$_POST['tel'];
$email=$_POST['email'];
$QQ=$_POST['QQ'];
$sex=$_POST['sex'];
$brandname=$_POST['brandname'];
$commoditybrand=$_POST['commoditybrand'];
$productID=$_POST['productID'];
$ordername=$_POST['ordername'];
$shopname=$_POST['shopname'];
$shopaddr=$_POST['shopaddr'];
$invoicenumber=$_POST['invoicenumber'];
$purchasingdate=$_POST['purchasingdate'];


require_once("conn.php");
if(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)){
echo "添加成功!查看数据库";
}
else{
echo '添加失败!';
}

mysql_close($con);
?>

错误报告 如下 :
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))

人气教程排行