Reputation: 3050
I'm really stuck at this, I need to check two timestamps, and figure out if the user has been active for the last 15 minutes...
In database last_active int 11
while ($m = $this->db->fetch($query))
{
$members[] = $m;
//What to do here:
if ($members['last_active']
}
Upvotes: 0
Views: 420
Reputation: 157895
You're doing it wrong.
You have to do it at the SQL level, not application level.
Make your query like
SELECT * FROM users WHERE last_active > unix_timestamp() - 60*15
Upvotes: 1