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