try this code:
<?
if($db_ok)
{
?>
<html>
<body onload=doLoad();>
<?
}
?>
<script>
function doLoad()
{
//refresh value every 2 second
setTimeout( "refresh()", 2*1000 );
}
function refresh()
{
var sURL = unescape(window.location.pathname);
window.document.write(i++)
window.location.href = sURL;
}
</script>