[Solved]Trying to update field, Please help
Posted: Fri Mar 25, 2005 10:14 pm
Hye I'm trying to update a quantity field in a seperate table. Basically what i want to do is select the Item_id and the current quantity from that table. I then want to minus the quantity by 1 and the update the orders table.
I've got to a certain point and come to a brick wall
can someone help???
the php is as follows
Havnt got past the update, can somebody give me a hand???
Shab

I've got to a certain point and come to a brick wall
can someone help???
the php is as follows
Code: Select all
<?php
$item_id=$_POST['special'];
$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 = ;
mysql_select_db($database);
$result = mysql_query ("SELECT Special_quantity, Special_ID FROM specials ORDER BY Special_ID DESC LIMIT 1",$connect);
//$row = mysql_fetch_*($result);
//or die("Invalid query: " . mysql_error());
while ($row = mysql_fetch_row($result))
{
foreach ($row as $attribute);
}
$total = $attribute;
$newtotal = $total - 1;
$query = ("UPDATE specials SET");
//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);
?>Shab