Hello would really appreciate some help. I'm pretty new to php and even more of a noob when it comes to xml. Can any body see why I am getting a feed code error?.
Thanks in advance.
<?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.
echo “
<channel>
<title>Dan's iPhone Blog</title>
<description>The Latest iPhone News</description>
<link>cet-apache-02.cet.bolton.ac.uk/student/dpm1gcc</link>”;
// Create a connection to your database.
require(“db_connection.php“);
// Query database and select the last 10 entries.
$data = mysql_query(“SELECT * FROM Articles ORDER BY ArticleId DESC LIMIT 10”);
while($row = mysql_fetch_array($data))
{
// Convert database images data into actual image link.
$row[ArticleTitle] = str_replace(“images/”, “cet-apache-02.cet.bolton.ac.uk/student/dpm1gcc/images/”, $row[ArticleTitle]);
// Continue with the 10 items to be included in the <item> section of the XML.
echo “
<item>
<link>http://cet-apache-02.cet.bolton.ac.uk/student/dpm1gcc/article.php?ArticleId=”.$row[ArticleId].”</link>
<guid isPermaLink=\”true\”>http://cet-apache-02.cet.bolton.ac.uk/student/dpm1gcc/article.php?ArticleId=”.$row[ArticleId].”</guid>
<title>”.$row[ArticleTitle].”</title>
<description><![CDATA[“.$row[ArticleDescription].”]]></description>
<comments>http://cet-apache-02.cet.bolton.ac.uk/student/dpm1gcc/article.php?ArticleId=”.$row[ArticleId].”#Comment</comments>
</item>”;
}
// substr can limit the number of characters. First number is starting point while the second number is number of
characters.
// otherwise just use $row[Intro].
// <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>”;
?>