<? header('Content-type: text/xml'); ?>
<rss version="2.0">
<channel>
<title>IPR Printer Industry News</title>
<description>latest printer releases</description>
<link>http://www.ipr.co.nz/</link>
<copyright>Copyright IPR</copyright>
<?php
define ('DB_HOST', "localhost");
define ('DB_USER_NAME', "root");
define ('DB_PASSWORD', "");
define ('DB_NAME', "ipr");;
function sqlunEscape($sql) {
 
        /* De MagicQuotes */
    $fix_str    = str_replace("''","'",$sql);
    $fix_str     = str_replace("[NULL]","\0",$fix_str);

    return $fix_str;

} // sqlEscape

$connection = mysql_connect(DB_HOST, DB_USER_NAME,DB_PASSWORD) or die("Error connecting to database");
mysql_select_db(DB_NAME, $connection);
		
			$sql = "select * from news order by datenews DESC , seq DESC ";
			$result = mysql_query($sql,$connection);
			while ($row=mysql_fetch_array($result) ) 
			{
			 
				?>				
<item><title> <?=htmlentities(strip_tags(sqlunescape($row['title']))); ?></title>
<description> <?=htmlentities(strip_tags(sqlunescape($row['description']),'ENT_COMPATQUOTES'));?></description>
<link>http://www.ipr.co.nz</link><guid isPermaLink="false"><? echo strtotime($row['datenews']);?><? echo $row['seq'];?></guid>
<pubDate> <?=strftime( "%a, %d %b %Y %T %z" , strtotime($row['datenews'])); ?></pubDate>
</item>
	 <?}?>
	 </channel></rss>