Hello i want to refresh my php every 3 sec this is what i have:
<?php
session_start();
include "../config.php";
$time = time();
$sql1 = "UPDATE login SET lastlogin = '" .$time. "' WHERE id = '" .$_SESSION['userid']. "'";
$res1 = mysql_query($sql1) or die(mysql_error());
$onlinetime = "10"; // 10 seconds
$sql3 = "SELECT * FROM login ORDER BY lastlogin DESC";
$res3 = mysql_query($sql3);
while($row3 = mysql_fetch_array($res3)){
if($row3['lastlogin'] + $onlinetime > time()){
echo '<b><font color="green">✔</font></b> <u>'.$row3['name'].'</u><br />';
}else{
echo "<b><font color='red'>X</font></b> <u>".$row3['name']."</u><br />";
}
}
?>
This is not refreshing which is really irritating. It shows who's online at my chatbox. Someone help? Thanks.