monkeytooth Posted October 31, 2008 Share Posted October 31, 2008 Can I order my results descending from most recent additions to the database to first one ever posted in? without specifying "ORDER BY <column> DESC". when I do the generic $display_query = " SELECT * FROM comp WHERE status='active'"; type of code it pulls from the database listing the first post ever to most recent. If i add the order by <column> desc, it does it somewhat but, try's to alpha-numerically output everything (eg: 123 abc..) I tried it with using the IDs as well, the kind that auto generate upon input, but then it goes 10, 1, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3..... anyone know what i can do to just get it to go for sake of example 30-1 in reverse chronological order? Link to comment https://forums.phpfreaks.com/topic/130904-solved-php-mysql-order-question-help/ Share on other sites More sharing options...
rhodesa Posted October 31, 2008 Share Posted October 31, 2008 What dataype are the IDs? It should be an INTEGER type. If it is, it should sort the numbers NUMERICALLY not ALPHABETICALLY: $display_query = " SELECT * FROM comp WHERE status='active' ORDER BY id DESC"; Link to comment https://forums.phpfreaks.com/topic/130904-solved-php-mysql-order-question-help/#findComment-679484 Share on other sites More sharing options...
monkeytooth Posted October 31, 2008 Author Share Posted October 31, 2008 they are integer.. but it comes down to listing out in a scene like so.. 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 3........ and not like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13... like one would hope for.. and likewise for ascending them but reversed Ill try again, I am rewriting everything on that page as is, so it may have been something i missed messing with me in the previous coding i had done for it. Link to comment https://forums.phpfreaks.com/topic/130904-solved-php-mysql-order-question-help/#findComment-679494 Share on other sites More sharing options...
rhodesa Posted October 31, 2008 Share Posted October 31, 2008 if you can't figure it out, post a dump of the mysql table just so i can take a glance Link to comment https://forums.phpfreaks.com/topic/130904-solved-php-mysql-order-question-help/#findComment-679499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.