1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
<?php
include "connexion.php";
$query = "SELECT * FROM `tblgamesinfos` ORDER BY `Name` ASC";
$result = mysql_query($query);
if (mysql_numrows($result)>0)
{
$file= fopen("results.xml", "w");
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$_xml .="<site>\r\n";
while ($row = mysql_fetch_array($result)) {
if ($row["Name"]) {
$_xml .="\t<page title=\"" . $row["ID"] . "\">\r\n";
$_xml .="\t\t<file>" . $row["Plateform"] . "</file>\r\n";
$_xml .="\t</page>\r\n";
} else {
$_xml .="\t<page title=\"Nothing Returned\">\r\n";
$_xml .="\t\t<file>none</file>\r\n";
$_xml .="\t</page>\r\n";
} }
$_xml .="</site>";
fwrite($file, $_xml);
fclose($file);
echo "XML has been written. <a href=\"results.xml\">View the XML.</a>";
echo "<iframe src='results.xml'></iframe>";
}
else
{
echo "No Records found";
}
include "results.xml";
?> |
Partager