Page 1 of 1

Updating an amount

Posted: Mon Feb 13, 2006 4:43 am
by hame22
Hi

I have a database that holds data regarding registered members, this includes an amount of credits within a users account.

What I want to do is quickly updatethe users credits when they purchase some more.

I know i could do that by first finding out the users current credit amount from a query, put that into a variable, then add the new credit amount to the current balance to make a new varibale and then run another query to update the users record.

However I was wondering out of interest if all this could be achieved through one query or perhaps less code?

thanks in advance

Posted: Mon Feb 13, 2006 5:05 am
by onion2k

Code: Select all

update users set credits = credits+10000 where user_id = '1';