garevn Posted December 24, 2012 Share Posted December 24, 2012 Lets say i have 10 users in my database. I want to display 2 dynamic tables, one with the names from online users and one with the names from offline one.. Any suggestion i am a bit confused Quote Link to comment https://forums.phpfreaks.com/topic/272337-display-the-names-from-online-users/ Share on other sites More sharing options...
Christian F. Posted December 24, 2012 Share Posted December 24, 2012 The better solution is to save the "last online" time, which you update every time the user requests a new page from the server. Then just calculate if the time of the last update is older than the timeout, which you decide. If it is, then they're offline, if not then they're not. All you need is one extra field in the existing users table, nothing more nothing less. Quote Link to comment https://forums.phpfreaks.com/topic/272337-display-the-names-from-online-users/#findComment-1401166 Share on other sites More sharing options...
garevn Posted December 24, 2012 Author Share Posted December 24, 2012 But how i can i update the table when the user login.. i dont get it And the same question when he logout.. Quote Link to comment https://forums.phpfreaks.com/topic/272337-display-the-names-from-online-users/#findComment-1401167 Share on other sites More sharing options...
Christian F. Posted December 24, 2012 Share Posted December 24, 2012 Just send a UPDATE query to the database, same as you'd update any other field in a table. Quote Link to comment https://forums.phpfreaks.com/topic/272337-display-the-names-from-online-users/#findComment-1401168 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.