Hello,
i have the following problem:
My shopping cart stores the Quantity ought value of each item as
$HTTP_SESSION_VARS["ticteting"]->col("Quantity");
$row_rsadverts['ad5'] is the quantity still in stock for the item concerned
I need to make a value: $my_value_check a substraction between a recordset value $row_rsadverts['ad5'] minus $HTTP_SESSION_VARS["ticteting"]->col("Quantity");
This will check as the shopper goes to the payment card processor that the items he has in his cart have not sold out while he was shopping.
so, if $my_value_check is inferior or equal 0 for each item in the cart, the shopper should be redirected to a page called no_tickets.php.
If those items are still in stock, he should be redirected to cart_05.php
My system as described works.
Only there is one glitch...
it only checks the first row retireved of the recordset, instead of al the rows matching the query.
Therefore my suystems checks the first item in the carts availaility and redirect accordingly instead of checkin EACH item in the cart's availability and THEN redirect if one of them has become out of sotck
Recordset: (this is not where the problem is)
$my_value = $HTTP_SESSION_VARS["ticteting"]->col("ItemID");
mysql_select_db($database_to_octo, $to_octo);
$query_rsadverts = "SELECT * FROM adverts WHERE adverts.AID = $my_value";
$rsadverts = mysql_query($query_rsadverts, $to_octo) or die(mysql_error());
$row_rsadverts = mysql_fetch_assoc($rsadverts);
$totalRows_rsadverts = mysql_num_rows($rsadverts);
This is where the problem is.
The recordset retrieves the right row but only one of them, whereas it should check for each of the items in the cart before redirecting
$my_value_check = $row_rsadverts['ad5'] - $HTTP_SESSION_VARS["ticteting"]->col("Quantity");
if ($my_value_check <= 0) {
header("Location: no_tickets.php");
}
else
{
header("Location: cart_05.php");
I hope i am explaining things ok..
Many thanks,
Vinny