Jump to content

[SOLVED] php mySQL ORDER (question, help?)


monkeytooth

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.