Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you just want site.php to reload every 5 seconds and add 1 to whatever is the url for 'version' you could just use the following javascript (this is assuming that the user's edits are saved in sync) :</p> <pre><code>function getVar(name){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ){ return ""; }else { return results[1]; } } var version = getVar('vesion'); version = Number(version) + 1; window.setTimeout('window.location="http://test.com/site.php?version=' + version +'";' ,5000); </code></pre> <p>You may want to check that the version exists every 5 seconds instead. You would need to query the database from site.php for the current database version number and use:</p> <pre><code>&lt;?php //query your database ?&gt; window.setTimeout('window.location="http://test.com/site.php?version=&lt;?php echo $row['db_version_number']; ?&gt;";' ,5000); </code></pre> <p>this will reload the database and refresh the page with whatever version is in db_version_number data cell every 5 seconds</p> ### Edited to answer second question <p>to start at 10 an stop at 20: initial url for the window would be site.php?version=10</p> <p>then:</p> <pre><code>function getVar(name){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ){ return ""; }else { return results[1]; } } var version = getVar('vesion'); version = Number(version) + 1; if (version &lt; 20){ window.setTimeout('window.location="http://test.com/site.php?version=' + version +'";' ,5000); } </code></pre> <p>should do the trick</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload