hi i m writing a program it is workng fine but doesnot update my database it gives me error since there are 4 query how can i know which one is wrong
my part of program is:
$query2="SELECT * FROM rpms WHERE product_name='$raw_material1'";
$result2=mysql_query($query2) or die(mysql_error());
if ($result2)
{
$row=mysql_fetch_assoc($result2);
$tot_quantity=$row['quantity']-$mat1_req;
}
else {
echo "query for material1 failed";
}
$query3="SELECT * FROM rpms WHERE product_name='$raw_material2'";
$result3=mysql_query($query3) or die(mysql_error());
if ($result3)
{
$row1=mysql_fetch_assoc($result3);
$tot_quantity1=$row1['quantity']-$mat2_req;
}
else {
echo "query for material1 failed";
}
$query4= "UPDATE rpms SET quantity='$tot_quantity' WHERE product_name='$raw_material1' AND quantity='$tot_quantity1' WHERE product_name='$raw_material2'";
$result4= mysql_query($query4) or die(mysql_error());
if ($result4)
{
echo " update successfully";
}
else
{
echo "updation failed";
}
$query5= "UPDATE rpms SET quantity='$tot_quantity1' WHERE product_name='$raw_material2'";
$result5= mysql_query($query5) or die(mysql_error());
if ($result5)
{
echo " update successfully";
}
else
{
echo "updation failed";
}
?>