Originally posted by victorb17
could you please post a snippet of the code used to insert the time? I'm not good with time or dates yet. Thanks!
Victor,
This is exactly how I do it. You will obviously need to modify the code for your use.
<?php
include('/home/sysera/public_html/concatenated/headers.php');
echo "<div style=\"text-align:left; font-size:9px; font-weight:bold;\">Users online: </div>";
$time = time();
$minutes = 10;
$minuteslong = $minutes * 60;
$timelimit = $time - $minuteslong;
if (isset($setuserid)) {
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($database) or die( "Unable to select database");
$query="UPDATE $users SET LASTONLINE = '$time' WHERE USERID = '$setuserid'";
mysql_query($query); }
$result = mysql_query("SELECT * FROM $users WHERE LASTONLINE >= '$timelimit' ORDER BY USERNAME ASC");
$userlist = '';
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$userlist = ("$userlist " . $row["USERNAME"]);
}
echo "<div style=\"text-align:left; font-size:9px;\">$userlist</div>";
mysql_free_result($result);
//mysql_close();
?>