Porkie Posted January 12, 2010 Share Posted January 12, 2010 hey everytime i save this as a php file it shows up but it just writes everything out in plain text doesnt show any off the stuff it is meant to, am i missing something here? <?php header('Content-Type: application/rss+xml'); echo '<?xml version="1.0" ?>'; echo '<?rss version="2.0" ?>'; echo '<channel>'; // Opens our main content echo '<title>GetRecognized</title>'; // Defines the title of the RSS feed echo '<link>http://www.news.getrecognized.co.uk</link>'; // Where the RSS feed is from echo '<description>Latest News From Inside GetRecognized HQ</description>'; // What its about echo '<copyright>Copyright GetRecognized 2010</copyright>'; // copyright information echo '<language></language>'; echo '<image>'; echo '<title>GetRecognized</title>'; echo '<url>http://www.news.getrecognized.co.uk</url>'; echo '<link>http://www.news.getrecognized.co.uk</link>'; echo '<width>30</width>'; echo '<height>50</height>'; echo '</image>'; $c = mysqli_connect('','','', '') or die(mysqli_error($c)); // Connect with our information $q = mysqli_query($c, 'SELECT * FROM ORDER BY id DESC') 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['rsstitle'].'</title>'; // Give it a title echo '<link>'.$r['rsslink'].'</link>'; // The link to the article echo '<description>'.$r['rsssdescription'].'</description>'; // The description or content of the article echo '<author>'.$r['rssauthor'].'</author>'; // The author echo '<pubDate>'.$r['rssdate'].'</pubDate>'; // The date is was published echo '</item>'; // End news article } // End while statement echo '</channel>'; echo '</rss>'; /code] Link to comment https://forums.phpfreaks.com/topic/188196-database-driven-rss-feeds/ Share on other sites More sharing options...
ram4nd Posted January 12, 2010 Share Posted January 12, 2010 I bet the problem is in your xml. Take a working feed for an example. Link to comment https://forums.phpfreaks.com/topic/188196-database-driven-rss-feeds/#findComment-993596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.