Newsest News First<

liunx

Guest
I am making a news script, and I can't find an explanation on how to display the newest news first. I have my ID row on auto increment, in my MySQL database, so is there a way to reverse it, or is there some PHP to make the newsest entries are on the top of the list when I display it?

Thanks.you could add a date field to your table and sort it
order by date desc limit 1Or you could order by the ID column, descending.

Example:
SELECT headline FROM news_table ORDER BY id DESC LIMIT 10;

Should pull the last 10 headlines
 
Back
Top