| | |
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 |
apache api array basic beginner binary body broken cakephp class cms code computing confirm cron curl customizableitems database date date/time delete display dynamic echo email error file files filter folder form forms forum function functions gc_maxlifetime global google headmethod href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php phpmysql query question random recourse recursion regex script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube






