Mko Posted March 27, 2012 Share Posted March 27, 2012 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 https://forums.phpfreaks.com/topic/259836-while-statement-excluding-user-ids/ Share on other sites More sharing options...
cpd Posted March 27, 2012 Share Posted March 27, 2012 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; Link to comment https://forums.phpfreaks.com/topic/259836-while-statement-excluding-user-ids/#findComment-1331715 Share on other sites More sharing options...
Mko Posted March 27, 2012 Author Share Posted March 27, 2012 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 https://forums.phpfreaks.com/topic/259836-while-statement-excluding-user-ids/#findComment-1331716 Share on other sites More sharing options...
samshel Posted March 27, 2012 Share Posted March 27, 2012 add user_id != 1 to the query ?? Link to comment https://forums.phpfreaks.com/topic/259836-while-statement-excluding-user-ids/#findComment-1331718 Share on other sites More sharing options...
Mko Posted March 27, 2012 Author Share Posted March 27, 2012 add user_id != 1 to the query ?? Just realized that'd work, thanks haha. Link to comment https://forums.phpfreaks.com/topic/259836-while-statement-excluding-user-ids/#findComment-1331721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.