[Solved]No value is being retunred but there is
Posted: Sat Mar 26, 2005 12:25 pm
Hye
I'm trying to insert two specific values into a new table from a query i'm perfroming on a different table. I'm attempting to extract two values but neither seem to be inserted. I've tried error reporting on the query and no errors occur
Can somebody give me a hand please, really stuck????
Ther code is as follows. The other values which have been retrieved by the $POST have been inserted correctly.
Hope somebody can help
Shab

I'm trying to insert two specific values into a new table from a query i'm perfroming on a different table. I'm attempting to extract two values but neither seem to be inserted. I've tried error reporting on the query and no errors occur
Can somebody give me a hand please, really stuck????
Ther code is as follows. The other values which have been retrieved by the $POST have been inserted correctly.
Code: Select all
<?php
$item_id=$_POST['orderitem3'];
$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 = 'item';
mysql_select_db($database);
$result = mysql_query ("SELECT Item_Description, Item_Price from item where item_id = '$item_id'",$connect)
or die ("There was an error in the query");
while ($row = mysql_fetch_row($result))
{
$item_description=$row['Item_Description'];
$price=$row['Item_Price'];
}
$query = ("INSERT INTO emp_order VALUES ('','$item_description','$quantity','$comments','$user_name','$price','')");
PRINT '<br><font size ="4" colour="blue">';
IF (mysql_query($query))
PRINT "<center>Order Has Been Placed</Center></font><BR><BR>";
PRINT $item_description;
mysql_close($connect);
?>Shab