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(); ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted March 14, 2008 Share Posted March 14, 2008 ORDER BY win - loss Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.