<?
        $database = mysql_connect("web20.ama.uk.com", "mrs", "datas3t");
        mysql_select_db("mrs");

  $query = "select * from t_rss where (f_removed is null or f_removed=0) and f_hide_whats_new = 0 order by f_date desc";
  $result = mysql_query($query) or die(mysql_error());
  
   
  while($row = mysql_fetch_assoc($result)){
  
        $content_items  .= "<item rdf:about=\"{$row['f_link']}\">
        <title>".utf8_encode(html_entity_decode($row['f_title']))."</title>
        <link>".$row['f_link']."</link>
        <description>".html_entity_decode($row['f_description'], ENT_NOQUOTES, 'UTF-8')."</description>
        <dc:date>{$row['f_date']}</dc:date>
        </item>

        ";
                                              
     $content_rdf .= "<rdf:li rdf:resource=\"".$row['f_link']."\" /> \n";
  }
        $name = substr($filename,strrpos($filename,'/')+1);
  
        $content = "

        <rdf:RDF
        xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
        xmlns=\"http://purl.org/rss/1.0/\"
        xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
        xmlns:syn=\"http://purl.org/rss/1.0/modules/syndication/\"
        xmlns:admin=\"http://webns.net/mvcb/\"
        xmlns:taxo=\"http://purl.org/rss/1.0/modules/taxonomy/\"
        >

        <channel rdf:about=\"http://www.mrs.org.uk/rss/".$name."\">
        <title>MRS What's New</title>   
        <link>http://www.mrs.org.uk/</link>
        <description>The latest news, information and events from MRS, the world's largest association representing providers and users of market, social, and opinion research, and business intelligence.</description>
        <dc:language>en-gb</dc:language>
        <dc:rights>Copyright 2009, MRS</dc:rights>
        <dc:date>2009-11-11</dc:date>
        <dc:creator>itinfo@mrs.org.uk</dc:creator>
        <items>
        <rdf:Seq>
        ".$content_rdf."
        </rdf:Seq>
        </items>
        <image rdf:resource=\"http://www.mrs.org.uk/images/logorss.gif\" />
        </channel>

        <image rdf:about=\"http://www.mrs.org.uk/images/logorss.gif\">
        <title>MRS logo</title>
        <url>http://www.mrs.org.uk/images/logorss.gif</url>
        <link>http://www.mrs.org.uk/</link>
        </image>
        ".$content_items."
        </rdf:RDF>
        ";
  
  $content = str_ireplace(array("&ndash;", " & ", "<br/>", "<br />"),array("-", " and ", " ", " "),$content);
  
  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
  echo $content;  


?>

