hi i am making a program in php. it actualy involves two tables from database one is order and other product_details i want that when i select a order i get its product and quantity and respective to that product i find quantity of first raw material reqruired. and then multiply the quantity of 'order' and product table. i have written code its working and not giving me any error but value which it calculates is wrong my code is:
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("pras2");
$order= ($_POST['order_id']);
$query= " SELECT * FROM `order` WHERE Order_ID='$order'";
$result=mysql_query($query);
if ($result)
{
$row=mysql_fetch_assoc($result);
if ($row['order_status']=='pending')
{
$total_quantity=$row['quantity'];
echo "$total_quantity";
$product=$row['product_id'];
$query1="SELECT * FROM product_details WHERE product_name='$product'";
$result1=mysql_query($query1) or die(mysql_error());
if ($result1)
{
$row1=mysql_fetch_assoc($result1);
$quantity1=$row1['quantity1'];
$raw_material1=$row1['raw_material1'];
$quantity2=$row1['quantity2'];
$raw_material2=$row1['raw_material2'];
$quantity3=$row1['quantity3'];
$raw_material3=$row1['raw_material3'];
$mat1_req=$total_quantity*$quantity1;
echo "$mat1_req";
}
else
{
echo "second query failed";
}
}
else
{
echo "This order is in process now";
}
}
else
{
echo "No record found";
}
?>