Hey guys, I need to be able to execute either a php or jquery function to update a sql database every certain segment of time, 20 minutes for example, regardless of user activity on the website. Does anyone know the easiest way to do this? Thanks, any help is appreciated.
A:
Use a cron job that executes a php page:
wget http://www...com/cron.php
Put your database update script in cron.php
Ian Wetherbee
2010-08-09 18:37:17
+2
A:
The easiest way would be to make a PHP script that does the update, then use a CRON Job to run it every 20 minutes.
Rocket
2010-08-09 18:37:48
thanks for the quick responses guys, I've used a cron before on my own server, but i recently bought hosting on bluehost, can run cronjobs on my hosting like that?
Joe
2010-08-09 18:41:13
Supposedly, yeah. http://helpdesk.bluehost.com/index.php/kb/article/000168
Rocket
2010-08-09 18:53:52
A:
There is a solution but you have to have access to command line. But for information: You can make a php engine. So make a infinite loop while(true), inside use a sleep function and make the proper updates.
Centurion
2010-08-09 19:00:37
A:
I got it, on bluehost I just go to cronjobs and input the path to the php script, it worked great, thanks
Joe
2010-08-09 19:45:09