I want to put RSS feeder in my web site. I have created rss-feed.xml file and uploaded it to the server. It’s working file. But I want to list all the products in this page. So I created a php page. Here I fetch all the data from product table and wrote in to the xml file. But it’s not working see the code below.
$sql_pdct="SELECT * FROM tbl_category where bit_active =1 and int_category_id IN ( SELECT int_category_id FROM tbl_product WHERE bit_active =1 )";
$qry_pdct=mysql_query($sql_pdct);
If (mysql_num_rows ($qry_pdct)>0){
While ($row = mysql_fetch_array ($qry_pdct)){
$con=$row['str_category'];
$xml_content .= "<item>\r\n";
$xml_content .= "<title>".$con."</title>\r\n";
$xml_content .= "<description><![CDATA[ All your fancy content goes here... ]]></description>\r\n";
$xml_content .= "<link>http://www.your-domain-name.co.uk/folder/yourPage.html</link>\r\n";
$xml_content .= "<guid isPermaLink=\"true\">http://www.your-domain-name.co.uk/folder/yourPage.html</guid>\r\n";
$xml_content .= "</item>\r\n";
}
$xml_content .= "</channel>\r\n";
$xml_content .= "</rss>\r\n";
// open xml feed file and truncate to zero length
$xml_file = fopen("rss-feed.xml", "w");
// write xml content to xml file
fwrite($xml_file, $xml_content);
// close xml file
fclose($xml_file);
header("location:rss-feed.xml");
My table contain 12 items but the result showing only one item. How is it?
They all have the same GUID and are thus marked as being multiple versions of the same item.