get single value from query
Posted 19 October 2005 - 09:22 PM
$quantity = mysql_query("select qty from cart where cookieId = '" . GetCartId() . "' and itemId");
mysql_query("update items set stockcount = stockcount - '" . $quantity . "' where itemId = $itemId");
I want to update the items table to decrease the stockcount by the amount the person purchased, aka the value in the qty field in the persons cart.
I want the $quantity variable to be equal to the qty of the current item in my cart. database. as shown below. I know I am taking the full row in my first line of code, which is COMPLETELY wrong, but what is the correct method of getting that single value from the cart table, the qty value into the $quantity variable so I can use it in my stockcount deduction?
Thanks in advance!
Posted 19 October 2005 - 09:28 PM
$result = mysql_query("select qty from cart where cookieId = '" . GetCartId() . "' and itemId"); // might have something wrong with your query as well $quantity = mysql_result($result,0,0);
or [php] * 1000... PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...
Posted 19 October 2005 - 09:32 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users