I was wondering if somebody can help me on how to do multiple queries in one script????
The original code is as follows
Code: Select all
<?php
$item_id=$_POST['orderitem1'];
$comments=$_POST['comments'];
$quantity=$_POST['quantity'];
$user_name=$_POST['username'];
$hostname="localhost";
$mysql_login="root";
$mysql_password="*********";
$database="coachhouse";
$connect = mysql_connect("$hostname", "$mysql_login" , "$mysql_password");
$table_name = emp_order;
mysql_select_db($database);
$result = mysql_query ("SELECT item_Description from item where item_id = '$item_id'",$connect);
//$row = mysql_fetch_*($result);
//or die("Invalid query: " . mysql_error());
while ($row = mysql_fetch_row($result))
{
foreach ($row as $attribute);
}
$query = ("INSERT INTO emp_order VALUES ('','$attribute','$quantity','$comments','$user_name','')");
//mysql_query($query);
PRINT '<br><font size ="4" colour="blue">';
IF (mysql_query($query))
PRINT "<center>Order Has Been Placed</Center></font><BR><BR>";
PRINT $attribute;
mysql_close($connect);
?>Where and how could i modify the code to insert a second lookup query so that i may insert the price of the item for each record into the existing insert statement. the last field on the insert represnts where the price will go but that is currently blank.
To get the total price i am wanting to calcualte the quantity by the lookup price returned.
please help.
PHENOM| PLEASE REVIEW HOW TO POST PHP (notice on posting page)