Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.