Jump to content

RSS Code error


graham23s

Recommended Posts

Hi Guys,

 

my rss code is pretty basic:

 

<?php
include("inc/inc-dbconnection.php");
header('Content-type: text/xml'); 
?>
<rss version="2.0">
<channel>
<title>Firstchoicepharmacy.co.uk</title>
<description>First Choice Pharmacy - Cheap Online UK Pharmacy</description>
<link>http://www.firstchoicepharmacy.co.uk/</link>
<copyright>(c) 2008 Firstchoicepharmacy.co.uk</copyright>

<?php
$q_rss = "SELECT * FROM `fcp_products` ORDER BY `date_added` DESC LIMIT 30";
$r_rss = mysql_query($q_rss);

while ($a_rss = mysql_fetch_array($r_rss))
{

// vars
$rss_id = $a_rss['id'];
$rss_nm = htmlentities($a_rss['product_name']); 
$rss_de = strip_tags($a_rss['product_description']);
$rss_dt = $a_rss['date_added'];

?>
<item>
     <title><![CDATA[<?php print("$rss_nm"); ?>]]></title> 
     <description><![CDATA[<?php print("$rss_de"); ?>]]></description> 
     <link>http://www.firstchoicepharmacy.co.uk/product-information.php?productid=<?php print("$rss_id"); ?></link>
     <pubDate><?php print("$rss_dt"); ?></pubDate>
</item>  
<?php
} 
?>  
</channel>
</rss>

 

The problem is it works sometimes and other times it doesn't! from what i can gather some characters from the description seem to be causing errors! i'm not sure how to deal with the output so it doesn't error out!

 

any help would be appreciated!

 

thanks guys

 

Graham

 

 

Link to comment
https://forums.phpfreaks.com/topic/138480-rss-code-error/
Share on other sites

Hi Mate,

 

That's the thing, when i add products i check it randomly, sometimes it works great other times its:

 

http://www.firstchoicepharmacy.co.uk/rss-feed.php

 

This feed contains code errors.

 

i'm not sure which characters are making it break kinda thing!

 

cheers mate

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/138480-rss-code-error/#findComment-724090
Share on other sites

It seems you have some problems with UTF-8 characters. You should check your encodings (database, php source, php-database connection)

 

Use RSS validator, to guide you through some other issues.

http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.firstchoicepharmacy.co.uk%2Frss-feed.php

Link to comment
https://forums.phpfreaks.com/topic/138480-rss-code-error/#findComment-724108
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.