<br />@header("content-Type: text/html; charset=utf-8");<br />require_once 'inc/site_config.php';<br />require_once 'inc/db_connections.php';<br />require_once 'inc/function.php';<br />mysql_query('set character set "utf8"');<br /> session_start();<br />if($_REQUEST['action']=='postreg'){<br />$sql_check_usr="select * from `reguser` where `UserId`='".$_SESSION['uid']."'";<br />$info=mysql_query($sql_check_usr);<br />$dingdanhao=date("YmjHis").$info[UserId];<br />$spc=$_SESSION[producelist];<br />$slc= $_SESSION[quatity];<br />$shouhuoren=$_POST['trusername'];<br />$dizhi=$_POST['address'];<br />$youbian=$_POST['phone'];<br />$tel=$_POST['mob'];<br />$email=$_POST['email'];<br />if(trim($_POST['d_content'])==""){<br /> $leaveword="";<br /> }<br /> else{<br /> $leaveword=$_POST['d_content'];<br />}<br /> $xiadanren=$_SESSION['uid'];<br /> $time=date("Y-m-j H:i:s");<br /> $total=$_SESSION[total];<br /> <br />$sql_add_usr="INSERT INTO onlineorder (dingdanhao,spc,slc,UserName,address,phone,mobile,mail,yqinfo,OrderTime,UserId,total_price) VALUES ('$dingdanhao','$spc','$slc','$trusername','$address','$phone','$mob','$email','$d_content','$time','$xiadanren','$total')";<br />mysql_query($sql_add_usr);<br /><br />}
로그인 후 복사
php insert ------解决方案--------------------把SQL语句打印出来,然后到PHPMYADMIN等工具中运行SQL语句看看结果如何。
这个是常用的检查SQL正确性方法。
------解决方案--------------------$info=mysql_query($sql_check_usr);
$dingdanhao=date("YmjHis").$info[UserId];
$info 是个结果资源集,$info[UserId] 这样用不对
mysql_query($sql_add_usr) or die(mysql_error()); //这样看看是否报错