Making an SQL column reset every 24hrs

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
MikeD
Posts: 294
Joined: Thu Sep 08, 2011 4:28 am

Making an SQL column reset every 24hrs

Post 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
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Making an SQL column reset every 24hrs

Post by hallsofvallhalla »

User avatar
MikeD
Posts: 294
Joined: Thu Sep 08, 2011 4:28 am

Re: Making an SQL column reset every 24hrs

Post 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?
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Making an SQL column reset every 24hrs

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Making an SQL column reset every 24hrs

Post 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!
The indelible lord of tl;dr
Post Reply

Return to “Beginner Help and Support”