
March 21st, 2003, 07:30 PM
|
|
|
|
Join Date: Apr 2007
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
decrementing a value in mysql table using php...???
hi
I am building a online CD shop using php and mysql. I wanted to know how i could get the value say '40' in the mysql CD table to decrement by one everytime the user selects 'Buy'.
the code i am using at the moment is mysql statement:
$submit = mysql_query("UPDATE cd SET quantity(quantity-1) where cdid=$id");
so basically if the user wants to buy cdid '504' mysql should look at the table and select the row which has '504' in the cdid, and then decrement the value of quantity automatically everytime someone selects 'Buy'.
BUT
it doesn't seem to work, any ideas
I am a novice by the way !!!
many thanks to any feedback
|