Solved

Very simple mysql query question

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
The viewer will learn how to dynamically set the form action using jQuery.

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now