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
https://forums.phpfreaks.com/topic/111810-noob-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.