Jump to content

PHP - RSS


toxictoad

Recommended Posts

Hey all,

 

I followed a tutorial a while back and put together a php page for an RSS Feed and although it works as it is, I want it to pull more info fromt the database but I've tried all the obvious (to me) things and it's not working so can anyone help?

 

This is the working code

<?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>News From Around The World</title>
<description>News and Information from all over the web brought to you by phatjoints.com</description>
<link>http://www.phatjoints.com/</link>";
// Create a connection to your database.
require("config.php");
// Query database and select the last 10 entries.
$data = mysql_query("SELECT * FROM rssfeeds ORDER BY NewsID DESC LIMIT 10");
while($row = mysql_fetch_array($data))
{

// Continue with the 10 items to be included in the <item> section of the XML.
echo "
<item>
<link>http://www.phatjoints.com/newsfeeds/details.php?id=".$row[NewsID]."</link>
<guid isPermaLink=\"true\">http://www.phatjoints.com/newsfeeds/details.php?id=".$row[NewsID]."</guid>
<title>".$row[Title]."</title>
<description><![CDATA[".$row[Content]."]]></description>
</item>";
}
echo "
</channel>
</rss>";
?>

 

If I change the <description> tags to <content></content> the info doesn't show so I guess that the naming needs to be just right but I don't know what 'right' is...

 

I tried adding a line <source><![CDATA[".$row[source]."]]></source> but that doesn't work either. The thing is, it's also XML in the PHP so not even sure if this forum will be the right place to post but here I am  ;)

 

Hope you can help

 

Here's the feed link: http://www.phatjoints.com/newsfeeds/rsstestfeed.php

Link to comment
https://forums.phpfreaks.com/topic/135160-php-rss/
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.