Solved

Very simple mysql query question

Posted on 2003-11-06
5
218 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
Comment Utility
$result = mysql_query("SELECT * from articles where dateadded >= now() - interval 7 day ORDER BY dateadded DESC");

loz
0
 
LVL 2

Author Comment

by:Breadstick
Comment Utility
Thanks.
0
 

Expert Comment

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

Expert Comment

by:lozloz
Comment Utility
yes, that is what i said
0
 
LVL 13

Expert Comment

by:lozloz
Comment Utility
<?
function echo_echo() {
  echo "echo";
  echo_echo();
}
?>

:p
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 29
Modify PHP Code on the Fly? 8 38
php variable basic question 12 26
while loop in html mail format 5 30
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

728 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

9 Experts available now in Live!

Get 1:1 Help Now