How to show RSS of last 10 entries?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

How to show RSS of last 10 entries?

Post by Sindarin »

I know RSS is made out of xml. I have my news entries in a news table (news_id,news_title,news_content,news_image,news_tags) . How do I do so that when a user clicks on the rss link, an xml file with the 10 latest entries desc appears?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: How to show RSS of last 10 entries?

Post by onion2k »

Getting the latest 10 results is easy -

Code: Select all

SELECT * FROM `news` ORDER BY `publish_date` DESC LIMIT 10
Then you just need to echo them out in the right format for an RSS feed.
Post Reply