ryeman98 Posted June 22, 2008 Share Posted June 22, 2008 I want to decrement without having to retrieve the value by selecting and turning it into an array, blah blah blah. How do I do something like this: <?php $update = mysql_query("UPDATE `table` SET amount='{amount-1}' WHERE id='$id'"); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted June 22, 2008 Share Posted June 22, 2008 $update = mysql_query("UPDATE `table` SET amount=amount-1 WHERE id='$id'"); Quote Link to comment Share on other sites More sharing options...
ryeman98 Posted June 22, 2008 Author Share Posted June 22, 2008 $update = mysql_query("UPDATE `table` SET amount=amount-1 WHERE id='$id'"); Simple enough ... didn't think it would work but I guess I'll try it Quote Link to comment Share on other sites More sharing options...
trq Posted June 22, 2008 Share Posted June 22, 2008 Thats a great idea. Quote Link to comment Share on other sites More sharing options...
ryeman98 Posted June 22, 2008 Author Share Posted June 22, 2008 Thats a great idea. Didn't work. amount was 10 and it was supposed to take away 1 but took away all 10. Quote Link to comment Share on other sites More sharing options...
trq Posted June 22, 2008 Share Posted June 22, 2008 What field type is amount? Quote Link to comment Share on other sites More sharing options...
Darklink Posted June 22, 2008 Share Posted June 22, 2008 Use INT or DOUBLE. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.