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
|
<?
header("Content-type: text/xml");
$host = "xxxxxxxxxxxxx";
$user = "xxxxxxxxxxxxx";
$pass = "xxxxxxxxxxxxx";
$database = "xxxxxxxxxxxxx";
$linkID = mysql_connect($host, $user, $pass) or die("Impossible de se connecter.");
mysql_select_db($database, $linkID) or die("Impossible de trouver la base.");
$query = "SELECT * FROM xxxxxxxxxxxxx";
$resultID = mysql_query($query, $linkID) or die("Données non trouvées.");
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$xml_output .= "<Oeuvre>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<Livre>\n";
$xml_output .= "\t\t<Page>" . $row['Page'] . "</Page>\n";
$xml_output .= "\t\t<Auteur>" . $row['Auteur'] . "</Auteur>\n";
$xml_output .= "\t\t<Edition>" . $row['Edition'] . "</Edition>\n";
$xml_output .= "\t</Page>\n";
}
$xml_output .= "</Oeuvre>";
echo $xml_output;
?> |