Page 1 of 1

Making an SQL column reset every 24hrs

Posted: Wed Oct 05, 2011 7:01 pm
by MikeD
I'm unsure where to really start on this. In my game, the better player you buy, the more dungeon, and battles you get everyday.

So in my characters table, I give an example of a Free Player, 1 dungeon and 1 pvp battle everyday. When they go through the dungeon, it will update the column to 0 dungeons.

How would I make that reset back to 1 every 24 hours. Hope I made myself clear, if you're confused just ask :P

Re: Making an SQL column reset every 24hrs

Posted: Wed Oct 05, 2011 7:09 pm
by hallsofvallhalla

Re: Making an SQL column reset every 24hrs

Posted: Wed Oct 05, 2011 7:11 pm
by MikeD
hallsofvallhalla wrote:use a cron

http://www.youtube.com/watch?v=uUKWwaqZPy0
Thanks, will watch it when I get home tonight. Is it simple to do/use?

Re: Making an SQL column reset every 24hrs

Posted: Wed Oct 05, 2011 7:39 pm
by hallsofvallhalla
very,

if your host does not support crons then you can make a windows service run a php script on the interval. Just have it load the page in a browser.

Re: Making an SQL column reset every 24hrs

Posted: Wed Oct 05, 2011 9:35 pm
by Jackolantern
I am sure you note it in the video, but I will mention it here as well since it confuses a lot of new users: crons are not part of PHP! Crons are a feature of Linux/Unix. Therefore, you will not be able to set up crons on your Windows development computer, although as Halls just mentioned, you can set up scheduled tasks on Windows as well.

We get a lot of potential cron enthusiasts who think it is part of PHP, and get frustrated when they can't find it in Windows!