Jump to content


This topic is now archived and is closed to further replies.


**SOLVED** Add to a number

Recommended Posts

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 script

How 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]


Share this post

Link to post
Share on other sites

[code]$creds = 50;
$user = 5;

$sql = "UPDATE user_info SET user_credits = user_credits+'$creds' WHERE user_id = '$user' ";[/code]

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.