Solved

Very simple mysql query question

Posted on 2003-11-06
5
223 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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.  …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

738 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