Zepo. Posted March 2, 2008 Share Posted March 2, 2008 I have a loop thats ordered by the field proiority. It works fine untill the priority gets above 9. http://www.eliteladders.com/development/ladders.php As you can see it put it after 1. $groups=mysql_query("SELECT id,name,logo,active,priority,created FROM groups WHERE active='1' ORDER BY priority"); while(list($gid,$gname,$glogo,$gactive,$gpriority,$gcreated)=mysql_fetch_row($groups)){ Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/ Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 What field type is priority? Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/#findComment-481351 Share on other sites More sharing options...
Zepo. Posted March 2, 2008 Author Share Posted March 2, 2008 varchar Limit 4 Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/#findComment-481353 Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 There your problem. A varchar field will be ordered alphabetically. it will need to be an INT type. Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/#findComment-481355 Share on other sites More sharing options...
Zepo. Posted March 2, 2008 Author Share Posted March 2, 2008 Thank you very much sir. Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/#findComment-481356 Share on other sites More sharing options...
sasa Posted March 2, 2008 Share Posted March 2, 2008 try ORDER BY priority+0 Quote Link to comment https://forums.phpfreaks.com/topic/93946-mysql-order-by-issue/#findComment-481425 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.