affc Posted March 14, 2008 Share Posted March 14, 2008 Hope someone can help, How will I be able to set the ORDER by the score that is generated? At the moment I got it going by win draw loss, I just simply want to order it by $score but generates an error at the moment, <? // Retrieve data from database $sql="SELECT * FROM $tbl_name ORDER BY Help here plz win DESC, draw DESC, loss ASC"; $result=mysql_query($sql); $RankLadder = 0; // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ $score = $rows['win'] - $rows['loss']; ?> <tr align="center" valign="middle"> <td width="20" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><?php echo ++$RankLadder ?></font></div></td> <td width="100" height="22" background="line.gif"><font color="#000000" size="2"><? echo $rows['member']; ?></font></td> <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['win']; ?></font></div></td> <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['draw']; ?></font></div></td> <td width="50" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $rows['loss']; ?></font></div></td> <td width="60" height="22" background="line.gif"> <div align="center"><font color="#000000" size="2"><? echo $score ?></font></div></td> </tr> <? } mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/96112-need-help-with-order-by-total-score/ Share on other sites More sharing options...
Barand Posted March 14, 2008 Share Posted March 14, 2008 ORDER BY win - loss Link to comment https://forums.phpfreaks.com/topic/96112-need-help-with-order-by-total-score/#findComment-492043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.