phpretard Posted February 5, 2008 Share Posted February 5, 2008 The code below puts the number 125 before the number 25 when sorted asc. I am pretty sure it's because of the 1 in 125. I would like to arrange asc with the 25 first because these aren't the only numbers involved. Has anyone run into this before? $result = mysql_query("SELECT * FROM rentals ORDER by $var"); Any help ?? Link to comment https://forums.phpfreaks.com/topic/89592-solved-sort-order-problem/ Share on other sites More sharing options...
rhodesa Posted February 5, 2008 Share Posted February 5, 2008 What datatype is that is the column with 125 & 25 in it? I'm guessing it's VARCHAR. Should it be INT? Link to comment https://forums.phpfreaks.com/topic/89592-solved-sort-order-problem/#findComment-458985 Share on other sites More sharing options...
phpretard Posted February 5, 2008 Author Share Posted February 5, 2008 It will be all numbers. Link to comment https://forums.phpfreaks.com/topic/89592-solved-sort-order-problem/#findComment-458992 Share on other sites More sharing options...
phpretard Posted February 5, 2008 Author Share Posted February 5, 2008 I changed it and it worked. Thank you! Link to comment https://forums.phpfreaks.com/topic/89592-solved-sort-order-problem/#findComment-458993 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.