Re: Automatically +1 every 30 mins to a value in the database.

From: Date: Fri, 02 Jun 2006 12:55:56 +0000
Subject: Re: Automatically +1 every 30 mins to a value in the database.
Groups: php.db 
Request: Send a blank email to php-db+get-41977@lists.php.net to get a copy of this message
An alternative to cron jobs or scheduled tasks (if they're not an option) is to have a marker somewhere (probably in your database) that records a timestamp for the last 'gold' update then when someone does get around to accessing the database through normal operations, have it figure out how many 30 minute periods have occurred between the timestamp and now and update the gold then. The cron job is preferrable but if you're looking for alternate ideas, there's one for ya. Good luck! -TG = = = Original message = = = Hi there. I've posted this up on both this list, and the mysql 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 php which would achieve this. Regards, Alex. ___________________________________________________________ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com.

« previous php.db (#41977) next »