| | |
Run PHP script every 10 seconds
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Why do you need a script to run every 10 seconds? There has to be a more efficient way to do whatever it is you are trying to do.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Cron jobs are your easiest solution.
Another method would be making 2 PHP scripts to bounce off of each other.
File 1: Run the target script wait 10 seconds and call File 2.
File 2: Run target scritpt wait 10 seconds call File 1.
It would be advisable to make a script take in a $_GET value to 'exit' the scripts.
So once you go to file 1: in your browser, it will create a continuous loop which will bounce form one file to the next. Until you type in this exit command.
Another method would be making 2 PHP scripts to bounce off of each other.
File 1: Run the target script wait 10 seconds and call File 2.
File 2: Run target scritpt wait 10 seconds call File 1.
It would be advisable to make a script take in a $_GET value to 'exit' the scripts.
So once you go to file 1: in your browser, it will create a continuous loop which will bounce form one file to the next. Until you type in this exit command.
GardCMS :: Open Source CMS :: Gardcms.org
•
•
Join Date: Jun 2005
Posts: 11
Reputation:
Solved Threads: 0
Hi...
thanks for your responses. Well, I need it because I must update
database entries and perform new calculations every ten seconds.
Seems a good idea, but note the call must be don on the server.
I'll try it:-) As I know, CronJob's can't be executed regulary each
ten second or may be my Information false?
Greetings
thanks for your responses. Well, I need it because I must update
database entries and perform new calculations every ten seconds.
•
•
•
•
File 1: Run the target script wait 10 seconds and call File 2.
File 2: Run target scritpt wait 10 seconds call File 1.
I'll try it:-) As I know, CronJob's can't be executed regulary each
ten second or may be my Information false?
Greetings
•
•
•
•
Or you can simply ad
[php]header('refresh:10; url=same_page.php');[/php]
this header() function will active.
Will i run in a continuous loop forever? or only if the script is being viewed by a user.
Secondly, if this is running in a continuous loop.
how can we stop the execution ?
Drag...
GardCMS :: Open Source CMS :: Gardcms.org
Ir runs only when viewed by a user and will run in continuous loop until the user closes the browser.
Of course, you can setup a $_GET variable to count the loops and stop at some point
As far as I know, in header(refresh...) you can only specify the number of seconds the script has to wait untill refresh, not a certain hour.
Of course, you can setup a $_GET variable to count the loops and stop at some point
•
•
•
•
Thanks, good idea, can I use a timevalue, like refresh 12:00:xx
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: mysql_fetch_array(): supplied argument is not a valid MySQL
- Next Thread: mailer.php almost works :|
| Thread Tools | Search this Thread |
.htaccess alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email emptydisplayvalue encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert ip javascript joomla key keywords limit link login mail mail() memberships menu mlm multiple multipletables mysql mysql_real_escape_string network oop open passwords paypal pdf php provider query radio random redirect remote rss script search securephp server sessions smtp source space sql strip_tags syntax system table template tutorial update upload url user validator variable video voteup web youtube






