Mercurial > hg > extraction-interface
view _xampp/contrib/dom.php @ 26:579f03f8bee5
merge table books_info into table books (execute Home/Test)
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 03 Mar 2015 10:33:42 +0100 |
parents | b12c99b7c3f0 |
children |
line wrap: on
line source
<?php $dom = new DOMDocument('1.0', 'iso-8859-1'); $root = $dom->createElement('cds'); $dom->appendChild($root); mysql_connect("localhost","root",""); mysql_select_db("cdcol"); $result=mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;"); while( $row=mysql_fetch_array($result) ) { $cd = $dom->createElement('cd'); $cd->setAttribute('id', $row['id']); $titel = $dom->createElement('titel'); $titel->appendChild($dom->createTextNode($row['titel'])); $cd->appendChild($titel); $interpret = $dom->createElement('interpret'); $interpret->appendChild($dom->createTextNode($row['interpret'])); $cd->appendChild($interpret); $jahr = $dom->createElement('jahr'); $jahr->appendChild($dom->createTextNode($row['jahr'])); $cd->appendChild($jahr); $root->appendChild($cd); } header("Content-Type: text/xml;"); print $dom->saveXML(); ?>