porko2004 Posted March 28, 2009 Share Posted March 28, 2009 i am making a script to be order by level i was wondering is there a code that if someones level is the same it will then look at both level and another field if anyone knows the code please tell me. thank you. Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/ Share on other sites More sharing options...
ram4nd Posted March 28, 2009 Share Posted March 28, 2009 Dude you have to tel us details. The code can be made, it doesn't exist. Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-795665 Share on other sites More sharing options...
porko2004 Posted March 28, 2009 Author Share Posted March 28, 2009 <?php require('config.php'); $rank = mysql_query("SELECT c.name as CharName, c.level as Level, c.mate as Spouse, f.name as GuildName FROM cq_user as c LEFT JOIN cq_synattr as g ON (c.id = g.id) LEFT JOIN cq_syndicate as f ON (g.syn_id = f.id) WHERE c.profession = 15 OR c.profession = 14 OR c.profession = 13 OR c.profession = 12 OR c.profession = 11 OR c.profession = 10 ORDER BY c.level (I wanna add here if person same level it looks at money) DESC LIMIT 0,15 ;"); $i=1; echo "<table border='0' bgcolor='#FFDC74'> "; echo "<font size='9'><tr> <th><center>; Rank</center></th> <th><center>Character Name </center></th> <th>Level </th> <th>Spouse p; </th> <th> Guild Name </th> </tr>"; while($row = mysql_fetch_array($rank)){ echo '<tr style="background-color:#FFF2BD;"><td><div align="center" bgcolor="#FFFF00" >'.$i.'</td> <td><div align="center">'.$row['CharName'].'</td> <td><div align="center">'.$row['Level'].'</td> <td><div align="center">'.$row['Spouse'].'</td> <td><div align="center">'.$row['GuildName'].'</td> </tr> '; $i=$i+1; } ?> Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-795671 Share on other sites More sharing options...
dpacmittal Posted March 28, 2009 Share Posted March 28, 2009 order by c.level DESC, c.profession ASC LIMIT 0,15;"); Hope this helped. Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-795704 Share on other sites More sharing options...
porko2004 Posted March 29, 2009 Author Share Posted March 29, 2009 This didnt help thank you for trying but Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-796041 Share on other sites More sharing options...
dpacmittal Posted March 29, 2009 Share Posted March 29, 2009 Refer to this page. http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html It has every information about ORDER BY. Hopefully it will help you. Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-796093 Share on other sites More sharing options...
revraz Posted March 29, 2009 Share Posted March 29, 2009 Show us sample data and the result that you have and why you think it doesn't work. Link to comment https://forums.phpfreaks.com/topic/151491-little-questions-please-help/#findComment-796100 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.