<?php

header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
// Set RSS version.
echo "
<rss version=\"2.0\"> ";
// Start the XML. You'll want to change www.yoursite.com to your web site
echo "
<channel>
<title>{siteName}</title>
<description>麦群网,白领的网上红娘</description>
<link>http://www.myqun.com/</link>";

//Let's connect to the database. You need to add your info for host, username, password and database
$link = mysql_connect("localhost","zhiye_f","58406228") or die ("Could not connect to db");
mysql_select_db("zhiye", $link) or die("Could not connect to db");

//Let's get the blog data from the database
$data = mysql_query("SELECT * FROM phpizabi_blogs ORDER BY id DESC LIMIT 10");

//You can change the limit number to increase or decrease the amount being fed

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

//Let's change the timestamp to something people can read format is MM-DD-YYYY
$convert = date("F j, Y",$row[date]); 
// Continue with the 10 items to be included in the <item> section of the XML.
echo "
<item>
<link>http://www.myqun.com/?L=blogs.blog&amp;article=".$row[id]."</link>
<guid isPermaLink=\"true\">http://www.myqun.com/?L=blogs.blog&amp;article=".$row[id]."</guid>
<title>".$row[title]."</title>
<pubdate>".$convert."</pubdate>
<description><![CDATA[".substr($row[body], 0, 350)."]]></description>
</item>";
}

//Change the 350 above to reduce or increase the size of the description being fed.

// <guid> is an optional sub-element of <item> but recommended if you don?t want to receive a warning when validating your RSS.
echo "
</channel>
</rss>";
?>