Just wanted to say that I enjoyed Jubba’s guide for converting [URL=“http://www.kirupa.com/web/mysql_xml_php.htm”]database entries into XML… I wanted to show you guys my version from where I tweaked his ideas from it.
$query = "SELECT * FROM members";
$resultID = mysql_query( $query ) or die ( 'Error: ' . mysql_error () );
function member2xml( $param, $type, &$xml ) {
if( !is_numeric($type) )
$xml .= " <" . str_replace( " ", "", $type ) . ">" . htmlspecialchars($param, ENT_QUOTES) . "</" . str_replace( " ", "", $type ) . ">
";
}
$xml = "<?xml version=\"1.0\"?>
";
$xml .= "<contacts>
";
while( $r = mysql_fetch_array( $resultID ) ) {
$xml .= " <person>
";
array_walk( $r, "dish2xml", &$xml );
$xml .= " </person>
";
}
$xml .= "</contacts>";
I was using it for a cookbook, but just changed names around to a contactlist of a sort… but you get the idea! I just wanted to share it… and if anyone wants to reshare it, awesomeness!