order by help
Posted 03 March 2006 - 07:14 PM
but instead of ordering like 1,2,3,4, etc it orders it by 1,10,11,12,13.....2,20,21,22,.....3,4,5,6,7,8,9
if I sort the table trough phpmyadmin it sorts the same way as well, What am I doing wrong. Do I have to change the type of that field. it is currently a text field.
Posted 03 March 2006 - 07:20 PM
welcome to the forums! i hope you get lots of help here!
to get it to sort numerically, you have to have a numeric field, so, yes, you'd do better to have it as an INT field in the database. it is sorting alphabetically since it's a string, and alphabetically, the numbers are taken character by character and matched, not as a whole.
Posted 03 March 2006 - 07:35 PM
I just donated $20 to the cause.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users