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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.