Last updated on June 10th, 2020 at 08:25 pm

Today I am going to tell u how to create a simple RSS feed with Php and MySql. This blog is for those who want to add their website or blog to Google feed burner.

About Google Feed burner :

Google Feed burner is one of the best place to promote your blog mainly. It will help you to reach your goal. It help your user to get your latest news feed you created. You don?t need to add single link one by one it will automatically access your newly created blog. You simply just create XML file that contains your all news feed links of your blog.

Simple Xml File Structure :

<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0">


<title>Site Title</title>

<link> Your Blog address</link>

<description>Little Description about your blog</description>


<copyright>Copyright (C) </copyright>


<title>Your Blog Title </title>

<description><![CDATA[  Short Description of your blog  ]]></description>

<link>Complete link of your blog</link>




First create a table in your database



-- Table structure for table `feed`





  `title` text NOT NULL,

  `desc` text NOT NULL,

  `link` text NOT NULL,

  PRIMARY KEY (`sr`)


-- Dumping data for table `feed`



INSERT INTO `feed` (`sr`, `title`, `desc`, `link`) VALUES

(1, 'welcome to trinity blogs', 'Trinity blog is best programming blog for Beginners', 'your-blog-links.php'),

(2, 'About trinity blog', 'Trinity blogs are focused on window application, PHP, MySql ', 'your-page-link2.php');

Now we write code in Php and simply fetch the data from feed table and insert into XML layout. I hope you have basic knowledge of Php and Mysql.





                * Simple and easy


$conn = mysql_connect("localhost", "root", "");

$select_db = mysql_select_db("xmlfeed");

header("Content-Type: application/xml; charset=UTF-8"); // To output file in xml Format

$rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>';

$rssfeed .= '<rss version="2.0">';

$rssfeed .= '<channel>';

$rssfeed .= '<title>Trinity Blog</title>';

$rssfeed .= '<link></link>';

$rssfeed .= '<description>RSS feed of</description>';

$rssfeed .= '<language>en-us</language>';

$rssfeed .= '<copyright>Copyright (C)</copyright>';

$query = "SELECT * FROM `feed` ORDER BY sr DESC";

$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {


                /* Get category name */

                $rssfeed .= '<item>';

                $rssfeed .= '<title>' . $title . '</title>';

                $rssfeed .= '<description><![CDATA['. $desc. ']]></description>';

                $rssfeed .= '<link>' . $link. '</link>';

                $rssfeed .= '</item>';


$rssfeed .= '</channel>';

$rssfeed .= '</rss>';               

echo $rssfeed;


And Final Output

This XML file does not appear to have any style information associated with it. The document tree is shown below.


<rss version="2.0">
<title>Trinity Blog</title>
<description>RSS feed of</description>
<copyright>Copyright (C)</copyright>
<title>About trinity blog</title>
Trinity blogs are focused on window application, PHP, MySql
<title>welcome to trinity blogs</title>
Trinity blog is best programming blog for Beginners