problème pour récupérer toutes les lignes contenue dans un select
Bonjour, j'ai un problème pour récupérer toutes les lignes contenue dans mon
select, normalement j'en ai 3 et je n'en récupère que 2.
Le but final du code est de convertir le résultat de la requête vers un fichier xml, cela fonctionne sauf pour le problème précèdent.
Voici mon code pour la récupération des données
Code:
1 2 3 4 5 6 7 8
|
<?php
mysql_select_db($database_ConnexionMYSQL, $ConnexionMYSQL);
$query_rstest = "SELECT `match`.MATCH_ID, `match`.MATCH_DATE, `match`.MATCH_TIME, `match`.MATCH_PLAY FROM `match`";
$rstest = mysql_query($query_rstest, $ConnexionMYSQL) or die(mysql_error());
$row_rstest = mysql_fetch_assoc($rstest);
$totalRows_rstest = mysql_num_rows($rstest);
?> |
La pourtant $totalRows_rstest est bien égal a 3
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<body>
<?php
//echo $totalRows_rstest;
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
while ($row = mysql_fetch_array($rstest))
{
$xml_output .= "<MATCHS>\n";
$xml_output .= "<MATCH_ID>" .$row["MATCH_ID"]."</MATCH_ID>\n";
$xml_output .= "<MATCH_DATE>" .$row["MATCH_DATE"]."</MATCH_DATE>\n";
$xml_output .= "<MATCH_TIME>" .$row["MATCH_TIME"]."</MATCH_TIME>\n";
}
$xml_output .= "</MATCHS>\n";
?>
<?php file_put_contents ('test.xml', $xml_output);?>
</body> |
Merci pour le coup de main.
A bientot