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! Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
localhost Posted September 12, 2006 Author Share Posted September 12, 2006 thanks! works perfect! Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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.