.xml file not being rewritten.
Posted: Fri Mar 06, 2009 10:23 am
Hello, bros,
I have a php code that should write a .xml file.
Here it goes:
So, it should genereate a file called 'noticia.xml', which would be read by a flash. But it doesn't.
Strangely, I renamed this noticia.xml file through a FTP client and the flash cotinues to show the info contained within it. Anyway, why isn't the code above rewriting 'noticia.xml'?
I have a php code that should write a .xml file.
Here it goes:
Code: Select all
function xml(){
$xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n";
$xml .= "<noticia>\r\n";
$sel_noticia = mysql_query("SELECT * FROM noticia WHERE status_noticia='a' ORDER BY data_noticia DESC");
while($row_noticia=mysql_fetch_array($sel_noticia)){
$xml .= "<item>\r\n";
$xml .= "<titulo>\r\n";
$xml .= "<![CDATA[".utf8_encode($row_noticia['titulo_noticia'])."]]>\r\n";
$xml .= "</titulo>\r\n";
$xml .= "<texto>\r\n";
$xml .= "<![CDATA[".utf8_encode($row_noticia['materia_noticia'])."]]>\r\n";
$xml .= "</texto>\r\n";
$xml .= "<link>\r\n";
$xml .= "<![CDATA["."ler_noticia.php?id_noticia=".$row_noticia['id_noticia']."]]>\r\n";
$xml .= "</link>\r\n";
$xml .= "</item>\r\n";
}
$xml .= "</noticia>\r\n";
$open = fopen("../../swf/noticia.xml","w");
fwrite($open,$xml);
fclose($open);Strangely, I renamed this noticia.xml file through a FTP client and the flash cotinues to show the info contained within it. Anyway, why isn't the code above rewriting 'noticia.xml'?