Jump to content

Recommended Posts

Have started to program my own cricket management game and wish to have the database update every 60 seconds; this is to facilitate players who are not watching the actual game.

 

Games are starting (and finishing) at all times so it is not possible to allow the user to be the only one to activate the game code; it is also not possible to only play the games when the human players are online because other games depend on the results.

 

The only answer I can think of at the moment is to have a copy of firefox running on the server which runs the PHP code to update all current games and have this page automatically refresh every 60 seconds.  Is this even viable?

 

Any other suggestions?

 

James

Link to comment
https://forums.phpfreaks.com/topic/225791-updating-database-every-60-seconds/
Share on other sites

You can create a cron job for the php code to just update the database.

 

If you really need firefox to open for some reason it can be opened and closed running in background on the server.

 

Not sure linux, windows, but opening and closing firefox can be done by using bat files or some sort of exec, psexec to open and close in a timely manner. All the permissions and that good stuff will have to be worked out.

 

If need to actually have a firefox window open and playing but do a refresh , can add a header or meta redirect to refresh your pages.

meta refresh every 30 seconds same content page
<?php echo('<meta http-equiv="refresh" content="30">'); ?>

meta refresh in 30 seconds to a new page
<meta http-equiv="refresh" content="30;url=http://somesite.com/somepage.php">

using header
<?php  header( "refresh:30;url=somepage.php" ); ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.