Solved

Very simple mysql query question

Posted on 2003-11-06
5
222 Views
Last Modified: 2006-11-17
Here's what I got:

$result = mysql_query("SELECT * from articles where dateadded >= now() - interval 7 day");

That gives me the articles that were added within the last week.  I want the result to be sorted in reverse order by when they were added, so the most recent articles appear first.
0
Comment
Question by:Breadstick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 30 total points
ID: 9699320
$result = mysql_query("SELECT * from articles where dateadded >= now() - interval 7 day ORDER BY dateadded DESC");

loz
0
 
LVL 2

Author Comment

by:Breadstick
ID: 9707376
Thanks.
0
 

Expert Comment

by:kokriba
ID: 9720884
Simply add trhe following code @ the end of your SQL statement << ORDER BY dateadded DESC>>(DESC = decending)
0
 
LVL 13

Expert Comment

by:lozloz
ID: 9720913
yes, that is what i said
0
 
LVL 13

Expert Comment

by:lozloz
ID: 9720920
<?
function echo_echo() {
  echo "echo";
  echo_echo();
}
?>

:p
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question