Yeah thats what im trying to do, i kinda have this: (but im now lost!)
$uname = $_SESSION[_LICENSE_KEY_]['user']['user'] ;// get the persons etano user name
$utime = time(); // get the time
$uname_check = 'SELECT uname FROM `in_chatroom` WHERE uname = $uname';
$uname_query = mysql_query($uname_check);
$num_rows = mysql_num_rows($uname_query);
if(!$num_rows) { //if no rows, meaning no uname's in db matched theirs, we will add them.
$insert_new = mysql_query("INSERT into in_chatroom (utime, uname) values('$utime','$uname')");
} //end if NOT THERE
//this means that they're already in there, so we update info.
if($num_rows > 0) {
$update = mysql_query('UPDATE `in_chatroom` SET utime=\''.time().'\' WHERE uname = $uname');
if(!$update) die(mysql_error());
} // end UPDATE
//if time now - start time > 300 then its been 5 minutes, so we delete
$delete_old = mysql_query("DELETE FROM `in_chatroom` WHERE ((".time()."-utime) > 300)");
if(!$delete_old) die(mysql_error());
When you access the page it adds the username and time to the db table ok, but now im stuck!