1) UPDATE table SET money = money - 1 WHERE user = 1 LIMIT 1 2) UPDATE table SET money = money + 1 WHRE user = 2 LIMIT 2
Of course this wont check if the first user have the money, so you will have to check that too with a query in the beginning
What is 1 limit 1 and 2 limit 2?
Bill Cosby is my Father
Posts: 4
24 credits Members referred : 0
« Reply #6 on: Aug 25, 2008, 11:25:52 AM »
More correct solution will be:
- check balance and transfer possibility - transfer from account 1 to "wallet", decrease "balance 1" - check transfer (approve or reject) - if "approve": transfer from "wallet" to account 2, increase "balance 2", decrease "wallet" - if "reject": transfer from "wallet" to account 1, increase "balance 1", decrease "wallet"
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7927