Questo è il codice che scrive fisicamente il file XML
Codice PHP:
<? include("include/connessione.inc") ?>
<?php
// Query the database and get all the records from table
mysql_select_db($database_conn, $conn);
$query_rs = "SELECT id_par, id_gio_c1, id_gio_f1, round FROM lss_partite WHERE lss=1";
$rs = mysql_query($query_rs, $conn) or die(mysql_error());
$row_rs = mysql_fetch_assoc($rs);
$totalRows_rs = mysql_num_rows($rs);
$xml="<?xml version='1.0' encoding='utf-8'?>
<lss>";
if ($totalRows_rs > 0) {
do {
$xml.="
<dati>
<id_par>".$row_rs['id_par']."</id_par>
<id_gio_c1>".$row_rs['id_gio_c1']."</id_gio_c1>
<id_gio_f1>".$row_rs['id_gio_f1']."</id_gio_f1>
<round>".$row_rs['round']."</round>
</dati>";
} while ($row_rs = mysql_fetch_assoc($rs));
}
$xml.="
</lss>";
mysql_free_result($rs);
//fwrite($open,$xml);
?>
Il problema è che non mi cicla i risultati del DB oppure me li cicla ma mi apre più volte la dichiarazione XML e la radice...
Sapete aiutarmi?