Jump to content

Whos Online Array Not Working Properly....


Northern Flame

Recommended Posts

I have a whos online array that gets all the online users

and creates a link to there profile. It does grab the online

users but does not display all there information. Here is my

code:

 

<?php

$x = 0;
$nuser_q = mysql_query("SELECT username FROM users WHERE last_active > (NOW() - INTERVAL 5 MINUTE)");

if(mysql_num_rows($nuser_q) == 0){
	$config['whos_online'][0] = "<em>No Users Online</em>\n";
} else{
	while($nuser = mysql_fetch_array($nuser_q)){
		$config['whos_online'][$x] = '<a href="/members/profile.php?id='. $nuser['id'] .'&user='. $nuser['username'] .'">'. $nuser['display'] .'</a><br />';
		$x++;
	}
}
?>

 

when no one is online, it correctly displays

<em>No Users Online</em>

 

but when a user is online, lets say myusername is online,

it displays:

<a href="/members/profile.php?id=&user=myusername"></a><br />

 

as you see, it doesnt display the id or the display name,

am I doing something wrong in my code?

Link to comment
https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/
Share on other sites

Try changing

<?php
$config['whos_online'][$x] = '<a href="/members/profile.php?id='. $nuser['id'] .'&user='. $nuser['username'] .'">'. $nuser['display'] .'</a><br />';
?>

to

<?php
$config['whos_online'][$x] = '<a href="/members/profile.php?id='. $nuser["id"] .'&user='. $nuser["username"] .'">'. $nuser["display"] .'</a><br />';
?>

alright,

 

heres the link,

(ps. the website is still under construction so the template looks sloppy,

and if you go to the source code, go to where it says whos online and

you'll see what im talking about

 

http://www.northernflame.com/contact.php

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.