in reply to Daily Actions
The simplist way is from cron, or similar
update table set turns = turns+ x; update table set turns = max where turns > max; commit;
As a next option, if you don't have people logged on for days at a time, you can just give them their turns on login -- keep track of their last login date, and when they log in, give them (turns_per_day * (datediff(systime(), last_login))).
update table set last_login = sysdate(), turns_left = ( $turns_per_day * datediff( sysdate(), last_login )) where user_id = ?
update:: bah ... the second example didn't take into consideration order of operations:
update table set turns_left = ( $turns_per_day * datediff( sysdate(), last_login )) +, last_login = sysdate() where user_id = ?
|
|---|