PDA

View Full Version : Monthly reset for data


tango88
12-11-2006, 11:57 AM
Hi and I hope someone could help me here.

I have some flash games where the high scores are saved in a mySQL database via php. I was so happy when I finally got it to work.

Thing is, I'd like to reset it at the beginning of each month and I'm trying to figure out a way to do that.

My FTP program has a scheduler, but of course, my PC has to be on for it to work.

I thought of pulling a trick using the my_date.getUTCMonth(); script, but it reads the date from the user's machine, which may be totally wrong.

Or is there some kind of scheduler built into mySQL? I'm a real beginner when it comes to databasing! Anyone there that can help me?

Cota
12-11-2006, 01:02 PM
Find out of your web host supports cron jobs. If so, set up a script to reset everything and have the cron job trigger the script once a month.

tango88
12-12-2006, 05:15 AM
Thanks, Cota

Have to admit that I have no idea what a 'cron job' is, but it shouldn't take me long to find out.

Best wishes to you

tango88
12-12-2006, 06:56 AM
got it.

I'm running of a cheap webhosting server, but there's a workaround here:

http://www.bitfolge.de/pseudocron-en.html

This little app simulates a cron job using php by simply checking if anything is scheduled whenever a user visits the page.

This is what I had in mind originally, but I was stuck where flash reads the date from the USER's machine, which could be wrong.

Cota
12-12-2006, 08:52 AM
Glad you got it sorted.

jsebrech
12-12-2006, 09:35 AM
Yeah, the best way to go is probably checking whenever someone tries to read or save the highscores whether a month has passed, and clearing the highscores if it is the case. You should read the date on the PHP side instead of on the flash side. It's more reliable that way.