Rss script..
Posted: Mon Apr 13, 2009 12:38 am
Hallo,
I have some problems with a script that should generate a rss feed for a web page. The validator prompts me some errors right here.
Also the code doesn't return any data from sql. Can you help me with this?
Here is the code:
Thanks
I have some problems with a script that should generate a rss feed for a web page. The validator prompts me some errors right here.
Also the code doesn't return any data from sql. Can you help me with this?
Here is the code:
Code: Select all
<?php
header("Content-type: application/rss+xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
// Set RSS version.
echo "<rss version=\"2.0\">";
include("config.php");
// Start the XML.
echo "
<channel>
<title>Press Release</title>
<description>A description of the feed contents</description>
<link>http://www.quanticlab.com/</link>";
$sql="SELECT * FROM news LIMIT 10";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result)){
echo"
<item>
<link>http://www.quanticlab.com/press_release.php?id_news=".$row[id_news]."</link>
<guid isPermaLink=\"true\">http://www.quanticlab.com/press_release.php?id_news=".$row[id_news]."</guid>
<title>".$row[news_titlu]."</title>
<description><![CDATA[".$row[news_short]."]]></description>
</item>"
}
echo "
</channel>
</rss>";
?>
Thanks