Solved

Very simple mysql query question

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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.

690 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