XML/PHP : Content is not allowed in trailing section
- by Tristan
Hello, i have this message error and i don't know where does the problem comes from:
<?php include "DBconnection.class.php";
$sql = DBConnection::getInstance();
$requete = "SELECT g.siteweb,
g.offreDedie,
g.coupon,
g.only_dedi,
g.transparence,
g.abonnement ,
s.GSP_nom as nom ,
COUNT(s.GSP_nom) as nb_votes,
TRUNCATE(AVG(vote), 2) as qualite,
TRUNCATE(AVG(prix), 2) as rapport,
TRUNCATE(AVG(serviceClient), 2) as serviceCli,
TRUNCATE(AVG(interface), 2) as interface,
TRUNCATE(AVG(services), 2) as services
FROM votes_serveur AS v
INNER JOIN serveur AS s ON v.idServ = s.idServ
INNER JOIN gsp AS g ON s.GSP_nom = g.nom
WHERE s.valide = 1
GROUP BY s.GSP_nom";
$sql->query($requete);
$xml = '<?xml version="1.0" encoding="UTF-8" ?><GamerCertified>';
while($row = $sql->fetchArray()){
$moyenne_services = ($row['services'] + $row['serviceCli'] + $row['interface'] ) / 3 ;
$moyenne_services = round( $moyenne_services, 2);
$moyenne_ge = ($row['services'] + $row['serviceCli'] + $row['interface'] + $row['qualite'] + $row['rapport'] ) / 5 ;
$moyenne_ge = round( $moyenne_ge, 2);
$xml .= '<GSP>';
$xml .= '<nom>'.$row["nom"].'</nom>';
$xml .= '<nombre-votes>'.$row["nb_votes"].'</nombre-votes>';
$xml .= '<services>'.$moyenne_services.'</services>';
$xml .= '<qualite>'.$row["qualite"].'</qualite>';
$xml .= '<prix>'.$row["rapport"].'</prix>';
$xml .= '<label-transparence>'.$row["transparence"].'</label-transparence>';
$xml .= '<moyenne-generale>'.$moyenne_ge.'</moyenne-generale>';
$xml .= '<serveurs-dedies>'.$row["offreDedie"].'</serveurs-dedies>';
$xml .= '</GSP>';
}
$xml .= '</GamerCertified>';
echo $xml;
Thanks