[PHP] Re: How can I add records to database every 60 minutes???
even when youre not online? is the database online or local? another question is how is the game played in php? i take it scripts are being called over and over right? if so then add a time function to one of those scripts. when gameplay starts load the time to mysql (or a file) and then everytime the script is run check the time to see if the time has exceeded 60 minuets, if it has run you php script to load the data to mysql. you could even go the further step and have it check for internet conection and load to a file if failed, then load file(s) the next time a internet connection is detected. Phpu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello I'm making an online game in php and mysql. Can someone tell me how can I add records to database every 60 minutes (even when i'm not online) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How can I add records to database every 60 minutes???
i take it scripts are being called over and over right? if so then add a time function to one of those scripts. when gameplay starts load the time to mysql (or a file) and then everytime the script is run check the time to see if the time has exceeded 60 minuets, if it has run you php script to load the data to mysql. the trouble with this is what if no-one hits the page for several hours? will it run 3-4 updates at once, or just the one? i'm guessing what your actually after is cron. you'd be running it on a *nix box for this, but you get cron to run the script every hour. i'm guessing your making some kind of ticker? similar to that in www.planetarion.com ? it's a fairly easy thing to do, and if you do a search for planetarion clones, you'll find exactly what your looking for. don't have a script that runs permanently tho, please. huge waste of resources, and you've also got the problems of timeouts, and how to restart a script if it crashes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How can I add records to database every 60 minutes???
yea... if no one hits the website for hours then only a few updates will occur. you could however write a very small javascript to call on a php script every hour. Skate [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] i take it scripts are being called over and over right? if so then add a time function to one of those scripts. when gameplay starts load the time to mysql (or a file) and then everytime the script is run check the time to see if the time has exceeded 60 minuets, if it has run you php script to load the data to mysql. the trouble with this is what if no-one hits the page for several hours? will it run 3-4 updates at once, or just the one? i'm guessing what your actually after is cron. you'd be running it on a *nix box for this, but you get cron to run the script every hour. i'm guessing your making some kind of ticker? similar to that in www.planetarion.com ? it's a fairly easy thing to do, and if you do a search for planetarion clones, you'll find exactly what your looking for. don't have a script that runs permanently tho, please. huge waste of resources, and you've also got the problems of timeouts, and how to restart a script if it crashes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php