<?php
$db = mysql_connect('localhost','xxx','xxx') or die("Database error");
mysql_select_db('more', $db);
$query = "SELECT bag FROM bag";
// Perform Query
$result = mysql_query($query);
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<bags>\n";
for($x = 0 ; $x < mysql_num_rows($result) ; $x++){
$row = mysql_fetch_assoc($result);
$xml_output .= "\t<bags>\n";
$xml_output .= "\t\t<bag>" . $row['bag'] . "</bag>\n";
$xml_output .= "\t</bag>\n";
}
$xml_output .= "</bags>";
echo $xml_output;
?>
|