adrianTNT Posted December 4, 2008 Share Posted December 4, 2008 Hello. If I want to add 20 to a "user_funds" field in the table, is there a way to just tell mysql to increase funds field by 20? instead of creating a recordset first and read the current funds? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/135467-increasing-a-table-field-value-without-reading-its-value-first/ Share on other sites More sharing options...
.josh Posted December 4, 2008 Share Posted December 4, 2008 Assuming you have and know a unique id associated with the column... update tablename set user_funds = user_funds + 20 where id=$x Quote Link to comment https://forums.phpfreaks.com/topic/135467-increasing-a-table-field-value-without-reading-its-value-first/#findComment-705733 Share on other sites More sharing options...
adrianTNT Posted December 4, 2008 Author Share Posted December 4, 2008 Yes, and that was the thing I was looking for. Will try. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/135467-increasing-a-table-field-value-without-reading-its-value-first/#findComment-705735 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.