ianp Posted August 20, 2012 Share Posted August 20, 2012 I have this "SELECT * FROM servers WHERE status='Online' ORDER BY `bid` DESC"; but it outputs the order like this What am I doing wrong? row 1:bid:400 row 2:bid:9402 row 3:bid:320 Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/ Share on other sites More sharing options...
Maq Posted August 20, 2012 Share Posted August 20, 2012 Can you show us some sample data and table structure? What data type is column 'bid'? Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370854 Share on other sites More sharing options...
ianp Posted August 20, 2012 Author Share Posted August 20, 2012 I just figured it out, it was TEXT and I changed it to INT. Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370856 Share on other sites More sharing options...
Christian F. Posted August 20, 2012 Share Posted August 20, 2012 Saving integers in a varchar field leads to that problem, yes. Link to comment https://forums.phpfreaks.com/topic/267344-sql-ordering-incorrectly/#findComment-1370857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.