Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2004, 10:35 AM
Authorized User
 
Join Date: Jan 2004
Location: Manchester, , United Kingdom.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default PHP and SQL orders

Hi,

My database has a field called ID which is an auto increment integer. This starts at 1 and when a new record is added the value goes up to 2 etc etc.......

anyways the provblem is when im displaying this information through my PHP code. I want the newest entry to be displayed at the top of the records (like a news story does)

I have used the ORDER BY sql thingy to order the field in the normal manner but this gives the opposite effect that i desire.

Is there a SQL order that would flip this to display the newest entry at the top?

thanks
ASH:D

__________________
My new web design domain
www.askmultimedia.co.uk
 
Old November 6th, 2004, 10:57 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

There are two sort options, ORDER BY `field` ASC and ORDER BY `field` DESC, I assume you probably want the latter.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old November 7th, 2004, 08:27 AM
Authorized User
 
Join Date: Jan 2004
Location: Manchester, , United Kingdom.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default

that works super duper:D;):)

Ash
www.askmultimedia.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 Orders File stabor BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 5 September 10th, 2007 09:25 AM
Orders Page with GridView chenimen BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:36 AM
Counting unique orders rlull SQL Server 2000 1 November 12th, 2005 12:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.