Jump to content

While Statement - Excluding User IDs


Mko

Recommended Posts

So I have this code:

$skill_query = mysql_query("SELECT * FROM character_stats ORDER BY character_stats.". $fields[$skill] ." DESC LIMIT 0, $end", $c2) or print(mysql_error());
$user_query = mysql_query("SELECT user.username, user.userid, character_stats.uid FROM user, character_stats WHERE character_stats.uid = user.userid ORDER BY character_stats.". $fields[$skill] ." DESC LIMIT 0, $end") or print(mysql_error());
//WHERE user.usergroupid != 6 AND characters.banned = 0 
$rank = 1;
while($player = mysql_fetch_array($skill_query)){
if($user['userid'] != 1){
	continue;
}
$user = mysql_fetch_array($user_query);
if($rank >= $start)
output($rank, $user['username'], $user['userid'], $player['combat'], $level, number_format($exp));
$rank++;
}

 

Yet for some reason it doesn't work. I know that the

	if($user['userid'] != 1){
	continue;
}

Is the reason, but how do I fix it?

 

Basically, my goal is to display these highscores, but omit UserID 1.

 

Thanks.

Link to comment
Share on other sites

If you want to omit user ID 1 by using the "continue" statement you should test if it is equal to one, not if it is not equal to one.

 

if(user[userID] == 1) continue;

Is there any sort of method aside from the continue statement?

Reason I ask is that whenever I use it, the output information becomes blank and doesn't display :(

Link to comment
Share on other sites

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.