Northern Flame Posted January 29, 2008 Share Posted January 29, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/ Share on other sites More sharing options...
maxudaskin Posted January 29, 2008 Share Posted January 29, 2008 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 />'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452016 Share on other sites More sharing options...
Northern Flame Posted January 29, 2008 Author Share Posted January 29, 2008 that didnt make a difference, i still get the same output Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452018 Share on other sites More sharing options...
maxudaskin Posted January 29, 2008 Share Posted January 29, 2008 Can you give us a link? Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452019 Share on other sites More sharing options...
Northern Flame Posted January 29, 2008 Author Share Posted January 29, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452021 Share on other sites More sharing options...
maxudaskin Posted January 29, 2008 Share Posted January 29, 2008 I see one major problem... well, actually, I don't see it. Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452024 Share on other sites More sharing options...
Northern Flame Posted January 29, 2008 Author Share Posted January 29, 2008 ? Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452029 Share on other sites More sharing options...
maxudaskin Posted January 29, 2008 Share Posted January 29, 2008 Am I looking in the right spot? Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452030 Share on other sites More sharing options...
Northern Flame Posted January 29, 2008 Author Share Posted January 29, 2008 well you need to look at the source code to see the link, or else you are not going to see anything because theres nothing between <a></a>, go to view source code and look under <h2>Whos Online</h2> Quote Link to comment https://forums.phpfreaks.com/topic/88328-whos-online-array-not-working-properly/#findComment-452031 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.