Reversing Order

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

Reversing Order

Post by psurrena »

Here's a hopefully basic question:

Right now this piece of code displays articles from the lowest ID the highest, in other words, the oldest is first, the newest is last. How do I reverse the order?

Code: Select all

$query  = "SELECT id, title, abstract FROM article ORDER BY id";
Thank you,
Peter
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

$query  = "SELECT id, title, abstract FROM article ORDER BY id ASC";

Code: Select all

$query  = "SELECT id, title, abstract FROM article ORDER BY id DESC";
User avatar
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

Post by psurrena »

Incredibly quick! Thanks!
Post Reply