![]() |
Complicated MySQL if statement/update
Right I'm trying to do the following:
(pseudo) Code:
update tablename set `cash` = ( IF cash - # > 0 SET `cash` = `cash` - # ELSE SET `cash` = 0) WHERE uid = 1Someone said to use this yet I think its not how I think its supposed to be setup: Code:
UPDATE `mem` SET `uM` = ( |
Something like the following? The
@fValue variable is the amount to deduct.sql Code:
|
Substitute the necessary values (denoted by %d) however you want to do it (sprintf, etc.) and of course the table/column names!
SQL Code:
|
Ah thanks I'll give them a try when I get home the guys at phpfreaks just suck...@support
|
| All times are GMT. The time now is 02:56 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0