Jump to content

PHP creating an RSS Feed


cb154

Recommended Posts

Hi, I have a small piece of code that creates an RSS feed using a mysql database. The issue is the page itself is blank however if I right click and view source I can see all the feed there. I convert the dat time field into a standard RSS date field. The web address is http://vinovote.com/news/feed.php

 

My code is as follows

 

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>



<rss version="2.0">
<channel>
<title>Vinovote.com</title>
<description>The Latest News And Views From Around The Web</description>
<link>http://www.vinovote.com/</link>
<copyright>Your copyright information</copyright>

<?php
require_once('../Connections/connection.php');
mysql_select_db($database_vinovotedb, $vinovotedb);
$doGet = mysql_query("SELECT
feed_content.feed_content_id,
feed_content.feed_id,
feed_content.url,
feed_content.title,
feed_content.content,
feed_content.item_time,
Date_FORMAT(feed_content.item_time,'%a, %d %b %Y %T') AS pubDate
FROM feed_content
order by item_time desc
LIMIT 50
", $vinovotedb) or die(mysql_error());

while($result = mysql_fetch_array($doGet)){
?>

     <item>
        <title> <?php echo $result['title']; ?></title>
        <description> <?php echo $result['content'];?></description>
        <link><?php echo $result['url'];?></link>
        <pubDate> <?php echo  $result['pubDate']; ?></pubDate>
     </item>  
<?php } ?>  

</channel>
</rss>

 

 

Link to comment
https://forums.phpfreaks.com/topic/218294-php-creating-an-rss-feed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.