Forum Moderators: open

Message Too Old, No Replies

Increment for every record found to match criteria

         

LOTUz

9:07 pm on Feb 29, 2008 (gmt 0)

10+ Year Member



Hi everyone lets say i have a database like so:

[table]Usrnfo:
userid¦username¦password¦datajoin¦code¦money¦userpoints

[table]event:
eventid¦eventname¦status¦

[table]mybids:
mybidid¦eventid¦userid¦winloss¦checked¦usrbidstatus

is there a way to update the userpoints with one sql statement
so that if the user won the bid it will add 1 point for each
bid they won or minus 1 point for each bid they lost?

there is a seperate sql that sets mybids.checked i only need how
i can setup the above on mysql 4.0 or lower.

here is what i have so far, it doesn't quite do what i want it to.
All it does is adds 1 point to the users points even if they have
more than 1 won bid.

$pts=1
$adminrate=0.03;

[codes]
"UPDATE mybids,usrnfo set mybids.checked=1,usrnfo.userpoints=usrnfo.userpoints+$pts,
usrnfo.money=(usrnfo.money-(($adminrate*mybids.money)+mybids.money)) ".
" WHERE mybids.usrbidstatus=8 AND mybids.checked=0";
[/codes]
Thanks.