ririe44 Posted May 2, 2009 Share Posted May 2, 2009 So, my ORDER BY is sorting my results as 1, 10, 11, 12, etc. Not in real order. Is there something that can change that? $mand_accounts = mysql_query("SELECT * FROM `$tbl_name` WHERE `main` = 'Mandatory' ORDER BY 'priority' ASC") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/156485-solved-sorts-wrong/ Share on other sites More sharing options...
trq Posted May 2, 2009 Share Posted May 2, 2009 Firstly, your query is wrong. priority is an identifier not a string. $mand_accounts = mysql_query("SELECT * FROM `$tbl_name` WHERE `main` = 'Mandatory' ORDER BY priority ASC") or die(mysql_error()); What datatype is priority? Quote Link to comment https://forums.phpfreaks.com/topic/156485-solved-sorts-wrong/#findComment-824020 Share on other sites More sharing options...
ririe44 Posted May 2, 2009 Author Share Posted May 2, 2009 priority is a column in my table... simply numbers 1-25 or so Quote Link to comment https://forums.phpfreaks.com/topic/156485-solved-sorts-wrong/#findComment-824022 Share on other sites More sharing options...
trq Posted May 2, 2009 Share Posted May 2, 2009 priority is a column in my table... simply numbers 1-25 or so Im aware of that. What data type is it? It needs to be one of the numeric types if you expect numbers to be sorted correctly. Quote Link to comment https://forums.phpfreaks.com/topic/156485-solved-sorts-wrong/#findComment-824024 Share on other sites More sharing options...
ririe44 Posted May 2, 2009 Author Share Posted May 2, 2009 Sorry... I mis interpreted your question the first time... It was varchar, and I changed it to INT... Thanks for the pointer! Quote Link to comment https://forums.phpfreaks.com/topic/156485-solved-sorts-wrong/#findComment-824036 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.