localhost Posted September 12, 2006 Share Posted September 12, 2006 my users online script is only displaying one user even if two are active in the past 5 minutes...any ideas?script:[code=php:0]$FiveMinutes = time()-300; $UsersOnline = Query("Select * From `users` Where `LastActive` >= '" . $FiveMinutes . "'"); while ($FetchUsers = FetchArray($UsersOnline)) { $User = array($FetchUsers['Username']); } $Template = new Template("templates/ForumStatistics.tpl"); $Template->Tags(array( 'MemberCount' => "$MemberCount", 'ThreadCount' => "$ThreadCount", 'PostCount' => "$PostCount", 'UsersOnline' => "" . implode(", ", $User) . "")); $Template->Display();[/code]thanks! Link to comment https://forums.phpfreaks.com/topic/20453-urgent-users-online-only-displaying-one/ Share on other sites More sharing options...
btherl Posted September 12, 2006 Share Posted September 12, 2006 You need[code]$User[] = $FetchUsers['Username'];[/code]That will add the username into the next entry in the array.I assume that FetchArray() returns an associative array, not integer-indexed array. Link to comment https://forums.phpfreaks.com/topic/20453-urgent-users-online-only-displaying-one/#findComment-90167 Share on other sites More sharing options...
localhost Posted September 12, 2006 Author Share Posted September 12, 2006 thanks! works perfect! Link to comment https://forums.phpfreaks.com/topic/20453-urgent-users-online-only-displaying-one/#findComment-90172 Share on other sites More sharing options...
yong Posted September 12, 2006 Share Posted September 12, 2006 hi localhosti also want to do something about count user online,i look yours script ,i have a question .. like here:"$UsersOnline = Query("Select * From `users` Where `LastActive` >= '" . $FiveMinutes . "'");"what is "lastActive" and how can you control it?thanks... Link to comment https://forums.phpfreaks.com/topic/20453-urgent-users-online-only-displaying-one/#findComment-90177 Share on other sites More sharing options...
vrdallas7 Posted September 12, 2006 Share Posted September 12, 2006 All you have to do is debug what's going on. Take a look at what's in the database. Ifthe data is there move on to the next thing. Var dump your query. If it shows up in yourprint_r($variable) you gotta a template problem. Link to comment https://forums.phpfreaks.com/topic/20453-urgent-users-online-only-displaying-one/#findComment-90180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.