Creating a Custom RSS Feed with PHP and MySQL

Sun, Dec 27, 2009

RSS and PHP, RSS-Tools

RSS has become the standard technology for syndicating information to large audiences. Many people have something to say, but its finding the right audience for your voice that matters. A great place to start is by creating your own RSS feed and adding to it as often as you can.

In this article you’ll learn how to syndicate your own custom RSS feeds using PHP and MySQL. We’ll first learn how to create two database tables and then how to retrieve data from them which will be formatted into an RSS feed. Here’s an example of the completed RSS feed and a download link to the code. Let’s start by taking a look at how to create the MySQL database tables.

Creating the MySQL RSS Tables

An RSS feed consists of the main details for the feed, such as the title, description, url, image and so on. Next are the items, probably the most important parts of the feed. i.e., different stories from a newspaper, posts from a blog and so on. Therefore, we will create two database tables, the first is called webref_rss_details, which contains the details for the feed and the second is called webref_rss_items, which contains all of the items. If you would like to get a better idea of the RSS structure you can take a look at The Anatomy of an RSS Feed, which is a previous article I wrote on the basics of the RSS structure.

Read full article on WebReference

Leave a Reply

You must be logged in to post a comment.