nealec Posted February 21, 2012 Share Posted February 21, 2012 Im displaying scores from my database from highest to lowest but 10 always comes out first. Why? Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/ Share on other sites More sharing options...
AyKay47 Posted February 21, 2012 Share Posted February 21, 2012 ten is greater than 3 Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319520 Share on other sites More sharing options...
nealec Posted February 21, 2012 Author Share Posted February 21, 2012 Sorry my bad, i meant that 10 is always the lowest number.... 10, 3, 3, 7, 8, 9. Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319521 Share on other sites More sharing options...
AyKay47 Posted February 21, 2012 Share Posted February 21, 2012 are you ordering DESC? by the correct field? its hard to help you without seeing the SQL Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319522 Share on other sites More sharing options...
nealec Posted February 21, 2012 Author Share Posted February 21, 2012 All the other scores come out in correct order apart from 10. The score column contains just numbers. mysql_query("SELECT score FROM scores ORDER BY score DESC"); Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319523 Share on other sites More sharing options...
kicken Posted February 21, 2012 Share Posted February 21, 2012 Is the 'score' column a VARCHAR? If so that is wrong, you need to make it a numeric type such as INT. Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319525 Share on other sites More sharing options...
nealec Posted February 21, 2012 Author Share Posted February 21, 2012 Is the 'score' column a VARCHAR? If so that is wrong, you need to make it a numeric type such as INT. Thanks, works perfect now, guess i should have known that. Link to comment https://forums.phpfreaks.com/topic/257457-mysql-order-by-thinks-10-is-lower-then-3/#findComment-1319526 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.