tommyda Posted September 30, 2007 Share Posted September 30, 2007 Could someone please help me with this. SELECT * FROM freerolls ORDER BY prize desc <<< this is the code written on the page www.pokerdepositoptions.com/freerolls.php which is included in the index.php page if you look you will see that it is not ordering by the top prize and descending down to the smallest eg: \/ Ladbrokespoker.com Prize $500 19.00 Play Now Ladbrokespoker.com Prize $50 14.30 Play Now Vcpoker.com Prize $50 13.20 Play Now Ladbrokespoker.com Prize $250 17.00 Play Now Pacificpoker.com Prize $25 13.00 Play Now Vcpoker.com Prize $150 18.35 Play Now Vcpoker.com Prize $150 20.55 Play Now Can anyone please tell me what i am doing wrong? <?php include"includes/mysql.php"; // Get all the data from the "example" table $result = mysql_query('SELECT * FROM freerolls ORDER BY prize desc')or die(mysql_error()); echo '<table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="23" background="http://www.pokerdepositoptions.com/images/freerolls.jpg"><div align="center"></div></td> </tr> <tr> <td><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#333333">'; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo '<tr><td width="27%"><span class="style2"><a href="'; echo $row["url"]; echo '">'; echo $row["site"]; echo '</a></span></td>'; echo '<td width="28%"><span class="style5"> Prize $'; echo $row['prize']; echo '</span></td><td width="19%"><span class="style5">'; echo $row['time']; echo '</span></td><td width="26%"><span class="style5"><a href="'; echo $row["url"]; echo '">Play Now </a></span></td></tr>'; } echo" </table></td></tr></table>"; ?> Vcpoker.com Prize $100 16.50 Play Now Quote Link to comment https://forums.phpfreaks.com/topic/71264-order-by-prize-desc-not-descending-properly/ Share on other sites More sharing options...
BlueSkyIS Posted September 30, 2007 Share Posted September 30, 2007 what type of data field is the price stored in? varchar, decimal, int? Quote Link to comment https://forums.phpfreaks.com/topic/71264-order-by-prize-desc-not-descending-properly/#findComment-358439 Share on other sites More sharing options...
tommyda Posted September 30, 2007 Author Share Posted September 30, 2007 Ahhhh thank you its a verchar because originally I had a dollar sign in the values. I changed it to int and its all working perfectly thank you for your quick response! Quote Link to comment https://forums.phpfreaks.com/topic/71264-order-by-prize-desc-not-descending-properly/#findComment-358447 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.