Jump to content

noob help please


superblunt

Recommended Posts

Hi I got one Mysql INSERT and one Mysql UPDATE that I want to do

 

$sql1="INSERT INTO purchase (date, time, supplier, grade, mainitem, itemcode, itemmass, itemamount, gender, price)

VALUES('$date','$time','$companyname','$grade','$mainitem','$itemcode','$itemmass','$itemamount','$gender','$itemprice')";

 

$sql2="UPDATE mainitem SET totalstock = 36 WHERE mainitem = '$mainitem'";

 

if($companyname=='' or $grade=='' or $mainitem=='' or $itemcode=='' or $itemmass=='' or $itemamount=='' or $gender=='' or $itemprice=='')

{

echo "<b>Please add all fields</b>";

exit;

 

}

 

 

if (!mysql_query($sql1))

  {

  die('Error: ' . mysql_error());

  }

echo "1 record added";

 

if (!mysql_query($sql2))

  {

  die('Error: ' . mysql_error());

  }

echo "1 record Updated";

 

when it is done it only adds the INSERT and not the update even though it shows bought echo's

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.