Can anyone see a problem with this... it prints the id's but does not delete them??? any ideas why (no errors show)
<?php $time2 = time(); $result = mysql_query ("SELECT * from forum_whoonline order by id"); while ($row = mysql_fetch_array($result)) { $id = $row[id]; $time = $row[time]; if ($time <= time() - 600) { $result2 = mysql_query ("Delete from forum_whooline where id = $id"); echo $id; } else { echo 'nothing'; } } // Deleted all rows older than 10 mins, everyone else is online. ?>
Don't see your error, but you can just use one query to do all the dirtywork for you
DELETE FROM who_online WHERE time < UNIX_TIMESTAMP() - 600
After you've run the query you can see how many went with mysql_affected_rows