<?php header("Content-Type: application/xml");  ?>
<?php printf('<?xml version="1.0"  encoding="iso-8859-1" ?> '); ?>

<?php
require_once('Connections/default.php');
require_once('includes/functions.inc.php');
function rssTime($dt) { 
    $yr=strval(substr($dt,0,4)); 
    $mo=strval(substr($dt,5,2)); 
    $da=strval(substr($dt,8,2)); 
    $hr=strval(substr($dt,11,2)); 
    $mi=strval(substr($dt,14,2)); 
    return date("D, d M Y H:i:s", mktime ($hr,$mi,0,$mo,$da,$yr))." 3600"; 
} 

// begin Recordset
$query_bestsellingjewellery = "SELECT products.products_id, products.products_image, products.products_price, products.products_date_added,  products.products_ordered, products_description.products_name, 100 - ( products.products_price  / products.products_rrp  * 100) AS saving, products.products_price, products.products_rrp, products_description.products_description FROM products, products_description WHERE products_description.products_id = products.products_id AND products.products_status = 1 AND products_description.language_id =1 ORDER BY ((products.products_price * 1.175) / (products.products_rrp *1.175) * 100) LIMIT 0, 20";
$bestsellingjewellery = $default->SelectLimit($query_bestsellingjewellery) or die($default->ErrorMsg());
$totalRows_bestsellingjewellery = $bestsellingjewellery->RecordCount();
// end Recordset

 //PHP ADODB document - made with PHAkt 2.0.60
 
 function feedDesc($text) { 
	$text = str_replace(" & "," and ",$text);
	$text = str_replace("�","'",$text);
	$text = strip_tags($text);
	$text = str_replace("?","",$text);
	$text = str_replace("�","",$text);
	$text = str_replace("&pound;","",$text);
	$text = str_replace("?","",$text);
	
	return $text; 
}
?>



<rss version="2.0">
   <channel>
      <title>Find Jewellery Current Biggest Savings</title>
      <link>http://www.findjewellery.co.uk</link> 
	  <description>Current biggest savings available from Find Jewellery</description>
	  <pubDate><?php echo date("D, d M Y H:i:s",time())." 3600"; ?></pubDate>
		
		
		<?php // repeat
		  while (!$bestsellingjewellery->EOF) {
		?>
		
		
			<item> 
				<title><?php echo str_replace("&","and",$bestsellingjewellery->Fields('products_name')); ?></title>
				<link>http://www.findjewellery.co.uk/product_info.php?products_id=<?php echo $bestsellingjewellery->Fields('products_id'); ?></link>
				<description><?php echo feedDesc($bestsellingjewellery->Fields('products_description')); ?></description>
				<guid isPermaLink="true">http://www.findjewellery.co.uk/product_info.php?products_id=<?php echo $bestsellingjewellery->Fields('products_id'); ?></guid>
			</item>



<?php
    $bestsellingjewellery->MoveNext();
  }
?>
</channel>
  </rss>