Code Help!

Brad

Well-Known Member
Jun 5, 2012
2,320
993
how would i get this to show Only Online Rank 4

Code:
GetRanks = mysql_query("SELECT id,name FROM ranks WHERE id = 4 ORDER BY  name DESC");
                            while($Ranks = mysql_fetch_assoc($GetRanks))
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
You'd have to do a query to get all the online users, loop through them and find their rank and if it matches 4, do your shit.
 

IntactDev

Member
Nov 22, 2012
399
71
PHP:
$getRanks = mysql_query("SELECT * FROM users WHERE rank = 4 AND online = 1 ORDER BY username DESC");

That should work, if I remember anything about Habbo. That query should return all users that are online, that is rank 4.

EDIT: Oops. I know what I did wrong.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
I assume your users and online users are separate tables, if so, you'll have to do what I suggest. Not sure whether the SQL JOIN() command could help you. Look into it.
 

Users who are viewing this thread

Top