Porkie Posted August 13, 2009 Share Posted August 13, 2009 <?php echo '<?xml version="1.0" ?>'; echo '<rss version="2.0">'; echo '<channel>'; // Opens our main content echo '<title>Test Website RSS Feed</title>'; // Defines the title of the RSS feed echo '<link>http://www.testsite.com</link>'; // Where the RSS feed is from echo '<description>This RSS feed is all about the pie.</description>'; // What its about $c = mysqli_connect('localhost', '', '', '') or die(mysqli_error($c)); // Connect with our information $q = mysqli_query($c, 'SELECT * FROM news ORDER BY id DESC LIMIT 5') or die(mysqli_error($c)); // Query the table for 5 news articles sorting by 'id' while($r = mysqli_fetch_assoc($q)) // While there is more rows to get (max of 5) we get an associative array { echo '<item>'; // Begin a news article echo '<title>'.$r['title'].'</title>'; // Give it a title echo '<link>'.$r['permalink'].'</link>'; // The link to the article echo '<description>'.$r['content'].'</description>'; // The description or content of the article echo '<author>'.$r['author'].'</author>'; // The author echo '<pubDate>'.$r['date'].'</pubDate>'; // The date is was published echo '</item>'; // End news article } // End while statement echo '</channel>'; echo '</rss>'; /> im confused as when i load it up i get an error saying "XML Parsing Error: no element found Location: http://www.quad.co.uk/test1.xml Line Number 27, Column 3:?> --^" where could i be going wrong? thanks in advance Quote Link to comment Share on other sites More sharing options...
Cetanu Posted August 13, 2009 Share Posted August 13, 2009 I think it's the < > I'm not skilled in using RSS with PHP, but that struck me as one thing. http://www.ibm.com/developerworks/library/x-phprss/ Quote Link to comment Share on other sites More sharing options...
Porkie Posted August 13, 2009 Author Share Posted August 13, 2009 still confused lol, i had it before and are really unsure about the problem Quote Link to comment Share on other sites More sharing options...
Cetanu Posted August 13, 2009 Share Posted August 13, 2009 Why are you using the character codes for < and > ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.