Jump to content

users online question


janim

Recommended Posts

You need to make a datetime field in your users table called something like "last_active". Then on your header page (so the code is called every time they click) you need to put a query that updates that field to the current date/time (you can use the function NOW() to do that).

 

Now to get the current users that have been active in the last 5 minutes, your query would look like this.

 

SELECT username FROM users WHERE last_active > (NOW() - INTERVAL 5 MINUTE)

Link to comment
https://forums.phpfreaks.com/topic/83073-users-online-question/#findComment-422597
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.