WilliamMute
Programmer
- Jan 4, 2006
- 117
Hi Again,
not sure the way forward. I am certain this code for updating the quantity on my self made shopping cart is a time bomb which will probably crash my computer when executed. Basically, I have an update field on my cart where the user simply types in desired number of the products they want.
I know that the above code is not right because how can I get my product id from the cart page in other to use it on my query? I have already use the $_GET[id]; function to receive the initial quantity.
Thanks for your help again.
not sure the way forward. I am certain this code for updating the quantity on my self made shopping cart is a time bomb which will probably crash my computer when executed. Basically, I have an update field on my cart where the user simply types in desired number of the products they want.
Code:
<?php
$quantity = $_GET[id];
{
mysql_select_db($database_Connection, $Connection);
if($quantity <= 0) $query =
"DELETE FROM ylabelcart WHERE ylabelcart.`product_id`='$var' AND ylabelcart.`session`='$cart_id'";
mysql_query ($query)
die("<META http-equiv=\"Refresh\" content=\"0;url=cart_view.php\">");
else
$query = "UPDATE ".$this->ylabelcart.
" SET quantity='$quantity' WHERE session='".$this->cart_id."' ";
$query .= "AND product_id='$product' ";
mysql_query ($query)
or die("There was a failure putting the required Product into your shopping basket, Please try again ".mysql_error());
die("<META http-equiv=\"Refresh\" content=\"0;url=cart_view.php\">");
}
?>
I know that the above code is not right because how can I get my product id from the cart page in other to use it on my query? I have already use the $_GET[id]; function to receive the initial quantity.
Thanks for your help again.