Já to dělám takhle a funguje mi to:
<?
mysql_connect("mysql.wz.cz","login","heslo");
mysql_select_db("login");
$file = "rss_clanky.xml";
$head = "<?xml version=\"1.0\" encoding=\"iso-8859-2\"?>
<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\" \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">
<rss version=\"0.91\">
<channel>
<title>Petr Bláha</title>
<link>http://blahapet.wz.cz</link>
<description>blahapet site - osobní stránky. Blahapet's Blog, Akordy na kytaru, Melodie na mobil, MIDI, Citáty, Příběhy, Vtipy, Básně, Pranostiky, Recepty, PHP&MySQL, Kniha návštěv, Fotoalbum.</description>
<language>cs</language>
<image>
<link>http://blahapet.wz.cz</link>
<url>http://blahapet.wz.cz/images/me.jpg</url>
<title>Petr Bláha</title>
<width>60</width>
<height>30</height>
</image>";
function body(){
$result = mysql_query("select * from clanky order by id desc");
while($r = mysql_fetch_array($result)):
$a .= "<item>";
$a .= "<title>".$r["nadpis"]."</title>";
$a .= "<description>".$r["clanek"]."</description>";
$a .= "<link>http://blahapet.wz.cz/index.php?what=./clanky/show&id=".$r["id"]."</link>";
$a .= "</item>\n";
endwhile;
return $a;
}
$foot = "
</channel>
</rss>";
$fp = fopen($file, "w");
fputs($fp, $head.body($a).$foot);
fclose($fp);
?>