This script worked just fine on my old server with php 4 compatibility. I moved to a new server that's php 5 only and it's not working please help. The script returns a list of members currently online, if the current time is no more than 120 seconds greater than their last activity time. The last activity time is updated every few seconds by another script as a timestamp (eg: 1308421786).
function getTimeStamp() {
return time();
}
//Who's Online
$query_omoline = "SELECT * FROM ttourmember WHERE '".getTimeStamp()."'-`chatactive` <120 AND `chata开发者_JS百科ctive`<>0 ORDER BY membername ASC";
$omoline = mysql_query($query_omoline) or die(mysql_error());
$row_omoline = mysql_fetch_assoc($omoline);
$totalRows_omoline = mysql_num_rows($omoline);
script then returns the results like this
<?php do { ?>
<?php
$omemname=$row_omoline['membername'];
$omemid=$row_omoline['memberid'];
if($totalRows_omoline>0){ ?>
<?php echo $row_omoline['membername']; ?>
<?php }} while ($row_omoline = mysql_fetch_assoc($omoline)); ?>
try adding true to the time call time(true). That way it converts the result to a float, which can be used for arithmetic operations. I am not sure if that's the problem here, since the operation is done in SQL-land, but its worth a try.
精彩评论