PHP INSERT INTO cannot insert data problem

Source: Internet
Author: User

The submission form inserts the data with insert into, but always blank, without prompting for an error. Excuse me, is there a problem?

@header ("content-type:text/html; Charset=utf-8 "); require_once ' inc/site_config.php '; require_once ' inc/db_connections.php '; require_once ' inc/ Function.php '; mysql_query (' Set character set "UTF8" '); Session_Start (); if ($_request[' action ']== ' Postreg ') {$sql _check_usr= "select * from ' Reguser ' where ' UserId ' = '". $_ session[' uid ']. "'"; $info =mysql_query ($sql _check_usr), $dingdanhao =date ("Ymjhis"). $info [UserId]; $SPC =$_session[producelist]; $SLC = $_ Session[quatity]; $shouhuoren =$_post[' trusername '); $dizhi =$_post[' address ']; $youbian =$_post[' phone ']; $tel =$_ post[' mob ']; $email =$_post[' email '];if (Trim ($_post[' d_content ') = = "") {$leaveword = "";} else{$leaveword =$_post[' D_ Content '];} $xiadanren =$_session[' uid ']; $time =date ("Y-m-j h:i:s"); $total =$_session[total]; $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 ') "; mysql_query ($sql _add_usr);} 


Reply to discussion (solution)

Print out the SQL statements and run the SQL statements in tools such as phpMyAdmin to see what the results are.
This is a common method of checking SQL correctness.

$info =mysql_query ($sql _check_usr);
$dingdanhao =date ("Ymjhis"). $info [UserId];
$info is a result resource set, $info [UserId] does not use

mysql_query ($sql _add_usr) or Die (Mysql_error ()); See if it's an error.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.