Add this in your html head section. Easy. It's not php though.
<META HTTP-EQUIV="Refresh" CONTENT="300">
Or the php, javascript way...
<?
/ 10/29/1999 mallsop
This example will constantly refresh your PHP/HTML page.
It is great for displaying realtime information.
Runs under PHP 3.x Tested only using Netscape.
Code expanded from the Pseudo Non Parsed Header example
by Warwick Steve (ukla@mediaone.net) on the http://webdev.berber.co.il/
website.
/
ECHO "<head><title>Constantly refresh your page.</title></head><body>";
ECHO "Starting...<br>";
flush();
sleep(2);
$i=1;
while ($i < 4) { // delay
ECHO "$i<br>"; // Display the counter.
flush();
sleep(1);
$i++;
} // end
// Query your database here. I am using sybase calls.
/* if (!@sybase_Connect("SERVERNAME, "USERNAME", "PASSWORD")) {
echo "<p><font color=\"red\">Error - Unable to connect to the sybase server. </font></p> \n";
exit;
}
if (!@sybase_select_db("SOMEDATABASENAME")) {
echo "<p><font color=\"red\">Error - unable to access the specific database. </font></p> \n";
exit;
}
$query_get_info = "SELECT FIELDA, FIELDB, FIELDC, FIELDD FROM SOMETABLE ORDER BY FIELDA";
$rs = @sybase_query($query_get_info); // execute the query
if ($rs) { // ok
$nrows = 0;
$nrows = @sybase_num_rows($rs);
echo "<p>Found $nrows row(s). </p> \n";
if ($nrows > 0) {
echo "<table border=\"1\" width=\"100%\" bordercolor=\"#000000\" bgcolor=\"#C0C0C0\" name=\"displaytable\"> \n";
$x = 0;
// display the table column headers
echo "<tr><th bgcolor=\"#6666FF\">FIELDA</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDB</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDC</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDD</th></tr> \n";
while ($x < $nrows) { // display the information
$display_row = @sybase_fetch_row($rs);
echo "<tr> \n";
$display_item1 = $display_row[0];
echo "<td>$display_item1 </td> \n";
$display_item2 = $display_row[1];
echo "<td>$display_item2 </td> \n";
$display_item3 = $display_row[2];
echo "<td>$display_item3 </td> \n";
$display_item4 = $display_row[3];
echo "<td>$display_item4 </td></tr> \n";
$x++;
} // end loop
echo "</table><br> \n";
} // end if nrows
} // end if rs
*/
ECHO "<br><b>In 5 seconds this page will refresh.</b><br>\n";
flush();
sleep(5);
// Now use javascript to send the page to itself.
?>
<SCRIPT LANGUAGE="JavaScript">
history.go(0)
</SCRIPT>
<?
ECHO "</body>";
?>
todd wrote:
I am trying to refresh the browser through php scripting. I am using a flash file that uses a php script to store information in a text file (unfortunately the text files will not update unless I hit the refresh button in the browser). The php script is self standing and is not nested in html, and does not use any java or vb script. Is this possible to do. Or, is there javascript code that will perform simply sitting in the .php3 file?
-todd@digitalorganism.com