include "../rcontrol/config.php";
include "../rcommon/database.php";
$remove = array("\x92", "\x96","\x97");
$query="SELECT * FROM `ynfx_mis_pricewatchglobal` WHERE `visibility` = 'Y' AND `approve` = 'Y' ORDER BY `id` DESC limit 20";
$result=mysql_db_query($DATABASE,$query);
$num = mysql_num_rows($result);
if ($num != 0)
{
$file= fopen("pricewatch.xml", "wb");
$_xml .="\r\n";
$_xml .="\r\n";
$_xml .="\r\n";
$_xml .="YarnsandFibers Textile PriceWatch\r\n";
$_xml .="http://www.yarnsandfibers.com\r\n";
$_xml .="YarnsandFibers Textile PriceWatch\r\n";
$_xml .="en\r\n";
$_xml .="[email protected]\r\n";
$_xml .="YarnsandFibers\r\n";
$_xml .="".date("r")."\r\n";
$_xml .="".date("r")."\r\n";
$_xml .="\r\n";
$_xml .="YarnsandFibers Textile PriceWatch\r\n";
$_xml .="http://www.yarnsandfibers.com/preferredsupplier/images/nhp/ynfx_logo.png\r\n";
$_xml .="http://www.yarnsandfibers.com/rpricewatch/index_main.php/\r\n";
$_xml .="\r\n";
for($i=0; $i<$num; $i++)
{
$id = mysql_result($result,$i,"id");
$body = mysql_result($result,$i,"highlights");
$date = mysql_result($result,$i,"recorddate");
$product = mysql_result($result,$i,"productid");
$sql="select name from ynfx_mis_product where id = '$product' and enable='1'";
$result3=mysql_db_query($DATABASE,$sql);
if(mysql_error()) error("Unexpected ERROR");
$product = mysql_result($result3,0,"name");
$_xml .="- \r\n";
$_xml .="".$product."\r\n";
$_xml .="http://www.yarnsandfibers.com/rpricewatch/index.php\r\n";
$_xml .="".$product."\r\n";
$_xml .="".str_replace($remove,"",$body)."\r\n";
$_xml .="
\r\n";
}
$_xml .="\r\n";
$_xml .="\r\n";
fwrite($file, $_xml);
fclose($file);
}
header("location:pricewatch.xml");
?>