List:General Discussion« Previous MessageNext Message »
From:Dan Buettner Date:June 2 2006 12:44pm
Subject:Re: Automatically add +1 every 30mins
View as plain text  
Alex, as Miles noted, this could easily be accomplished with an external 
cron event.  Doesn't have to be written in an external language like PHP 
or perl, even - could be a self-contained crontab entry a la:

0,30 * * * * /path/to/mysql -u user -psecret database_name -e "update 
table_name set gold = gold + 1" > /dev/null


To accomplish this within MySQL, one option might be 5.1's events:

http://dev.mysql.com/doc/refman/5.1/en/events.html
http://dev.mysql.com/doc/refman/5.1/en/create-event.html


Hope this helps,
Dan



Alex Major wrote:
> Hi there. 
> I've posted this up on both this list, and the php list as I'm not sure
> whether this is something that I'd need to do with the php or mysql.
> 
> Basically, I am making an add-on to my small website which is a mini online
> game. Every user will have gold, and every 30mins I'd like their amount of
> gold to go up by 1 (or say a variable say $goldupdateamount).
> 
> I'd like to know which would be the best way of doing this, and if there is
> a command in mysql which would achieve this.
> 
> Regards, 
> Alex.
> 
> 
> 
Thread
Automatically add +1 every 30minsAlex Major2 Jun
  • Re: Automatically add +1 every 30minsMiles Thompson2 Jun
  • Re: Automatically add +1 every 30minsDan Buettner2 Jun
    • Re: Automatically add +1 every 30minsMiles Thompson2 Jun
      • Re: Automatically add +1 every 30minsDouglas Sims2 Jun
        • Uninstall old versionnngau2 Jun
          • Re: Uninstall old versionDan Buettner2 Jun
        • RE: Automatically add +1 every 30minsDaevid Vincent4 Jun