EchoFool Posted August 8, 2008 Share Posted August 8, 2008 Hey need some help guys and gals. Just wondering how do i while loop data in order of word rankings.. for example... say "Leader" becomes before "Co-Leader". I have the rankings in the field rank. But i was unsure how to make it a list of words. This is what i put in my Select: <?php $Get = mysql_query("SELECT UserID,Rank FROM gangmembers WHERE GangID='$GangID' ORDER BY Rank='Leader',Rank='Co-Leader'") Or die(mysql_error()); While($row = mysql_fetch_assoc($Get)){ $Rank = $row['Rank']; $UserID = $row['UserID']; ?> <tr> <td width="200" align="center" class="blackBold"><?php echo $UserID;?></td> <td width="200" align="center" class="blackBold"><?php echo$Rank;?></td> <td width="200" align="center" class="blackBold"><a href="ganghq.php?team&fire=<?=$RecordID?>">Fire</a></td> </tr> <?php } } ?> Sadly it does not work though . Any suggestions? Link to comment https://forums.phpfreaks.com/topic/118853-data-output-order/ Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 Ranks are often stored numerically so you can order them properly, not as strings. >_< Link to comment https://forums.phpfreaks.com/topic/118853-data-output-order/#findComment-612065 Share on other sites More sharing options...
waynew Posted August 8, 2008 Share Posted August 8, 2008 Yep. Use numeric values. That way you can order them. Maybe keep a config array file somewhere to keep track of what is what. Link to comment https://forums.phpfreaks.com/topic/118853-data-output-order/#findComment-612068 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.