I have a PHP script that generates XML file, however something very strange is that it repeats several records from my table of real estate and the worse still is that there is no repeated real estate. Repeat the property ID with only one property for each ID.
Here is my code that generates XML:
$arquivo = "nuroa.xml";
$ponteiro = fopen($arquivo, "w");
fwrite($ponteiro, "<?xml version='1.0' encoding='utf-8'?>");
fwrite($ponteiro, '<nuroa>');
$sqlguiatexto = "SELECT id FROM imoveis";
$rsqlguiatexto = mysql_query($sqlguiatexto)
or die ("Não foi possível realizar a consulta ao banco de dados");
while($roweditusertexto = mysql_fetch_array($rsqlguiatexto))
{
$conteudo .= '<ad>';
$conteudo .= '<id><![CDATA['.$roweditusertexto['id'].']]></id>';
$conteudo .= '</ad>';
fwrite($ponteiro, $conteudo);
}
fwrite($ponteiro, '</nuroa>');
fclose($ponteiro);
Can anyone tell me what's going on for this? Strange is that there is no repeated record.
I look forward to helping you, thank you!