Jump to content

Archived

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

localhost

urgent! users online only displaying one!

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
hi localhost

i 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... 

Share this post


Link to post
Share on other sites
All you have to do is debug what's going on. Take a look at what's in the database. If
the data is there move on to the next thing. Var dump your query. If it shows up in your
print_r($variable) you gotta a template problem.

Share this post


Link to post
Share on other sites

×

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.