Imperialdata Posted March 31, 2006 Share Posted March 31, 2006 I have a database which I would like to do the following:In table_userinfo I have columns user_id and user_credits.I wish to add 50 to the number stored in user_credits for a single user (say user_id=5) via a php scriptHow is this best achieved? I have succeeded in retrieving the data from the field using return mysql_fetch_array($res,MYSQL_ASSOC);but I am struggling to add 50 to it and drop it back into the table.Thanks in advance----------------------------------------------------------[a href=\"http://www.TheBikeForum.com\" target=\"_blank\"]Like Motorcycles?[/a]---------------------------------------------------------- Quote Link to comment Share on other sites More sharing options...
Barand Posted March 31, 2006 Share Posted March 31, 2006 Simply[code]$creds = 50;$user = 5;$sql = "UPDATE user_info SET user_credits = user_credits+'$creds' WHERE user_id = '$user' ";[/code] Quote Link to comment Share on other sites More sharing options...
Imperialdata Posted April 1, 2006 Author Share Posted April 1, 2006 Thanks, that helps a lot! 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.