PHP Database Add failed

Source: Internet
Author: User
Tags php database
Add a database There's always a problem.
if ($fun ==3) {        $row =mysql_fetch_array (mysql_query ("select * from Production ORDER by Prono DESC LIMIT 0,")); $num = $r ow[' Prono '); $num + +; $nums = $num *10+3;echo "Add number: $num  Products:

if ($fun%10==3&& $fun!=3) {    $num =$_get[' fun ']; $num = ($num-3)/10; $itime =date ("YMD");    if (!empty ($_post[' iproname ')) {echo $itime;        $result = "INSERT into Prodution (Prono,proname,prokey,proprice,proplace,sumnum,sugar,fee,calorie,time,picture, Proweight,protype) VALUES  (' $num ', ' $_post[iproname ', ' $_post[iprokey] ', ' $_post[iproprice] ', ' $_post[ Iproplace] ', ' $_post[isumnum] ', ' $_post[isugar] ', ' $_post[ifee] ', ' $_post[icalorie ', ' $itime ', ' $_post[ipicture ', ' $_post[iproweight] ', ' $_post[iprotype] ') "; if (!mysql_query ($result, $corn)) echo "Add failed!!"; else echo "Add success!!";}

Database:


Reply to discussion (solution)

int type do not add ' character type to ' you look it up.

Mysql_error provide relevant error information, you do not go to see, blame Which?

$result = "INSERT into Prodution (Prono,proname,prokey,proprice,proplace,sumnum,sugar,fee,calorie,time,picture, Proweight,protype) VALUES (' $num ', ' $_post[iproname ', ' $_post[iprokey] ', ' $_post[iproprice] ', ' $_post[iproplace ', ' $_post[isumnum] ', ' $_post[isugar] ', ' $_post[ifee] ', ' $_post[icalorie] ', ' $itime ', ' $_post[ipicture ', ' $_post[ Iproweight] ', ' $_post[iprotype] ') ";

echo $result;

Output SQL put in MySQL tool execution look

Or

mysql_query ($result, $corn) or Die (Mysql_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.