The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Ordering mysql data from id highest first
joyful
post Apr 7 2011, 12:22 AM
Post #1


Advanced Member
****

Group: Members
Posts: 239
Joined: 15-November 10
Member No.: 13,147



Hey,

I have a very simple question:
I am using this code to order my MYSQL data:
CODE
$query = "SELECT * FROM news ORDER BY id";

How can I display my data by id with highest id number first (counting down)? I am using auto increment on id and need to display id highest first.

Thanks in advance.

--
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Apr 7 2011, 01:49 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



See http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html .
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
joyful
post Apr 7 2011, 10:26 AM
Post #3


Advanced Member
****

Group: Members
Posts: 239
Joined: 15-November 10
Member No.: 13,147



Thanks a lot Frederiek, this is exactly what I wanted!

--
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Apr 7 2011, 12:17 PM
Post #4


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



You're welcome.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 11:48 AM