Jump to content

PHP timed event?


Nevulus

Recommended Posts

Disclaimor:

I'm sorry in advance if this is posted somewhere else, I've searched and had very limited success. Yes, I'm a newb  ;D

 

Problem:

I am trying to create a timed event: Every hour I would like a script that will run a MySQL query (insert data into a table). Ive tried some loops which came up with a timed out error (exceeded 30 sec rule). I currently have a third party clock code that will display an updating time clock using php/javascript to compare server time/user time and come to a happy median. I don't know if appending to this code might help, or if I am better of starting from scratch.

 

It is quite simple, I just want to run my MySQL query every hour. Will a infinite loop use up too much server resources? Is it even possible to create an infinite loop in PHP? Have it check every so often if an hour has passed and then run my query.

 

Any help is much appreciated. Thank you for your patience.

Link to comment
https://forums.phpfreaks.com/topic/61071-php-timed-event/
Share on other sites

I think it will be too much of a hassle, especially if i try as an include to my index page, too much overhead produced by the script. I guess my only option is cron. Is there a difference from having php compiled as CGI or as an apache module? when configuring the php file for cron?

Link to comment
https://forums.phpfreaks.com/topic/61071-php-timed-event/#findComment-303971
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.