Mercurial > hg > extraction-interface
comparison _xampp/contrib/dom.php @ 0:b12c99b7c3f0
commit for previous development
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 19 Jan 2015 17:13:49 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b12c99b7c3f0 |
---|---|
1 <?php | |
2 | |
3 $dom = new DOMDocument('1.0', 'iso-8859-1'); | |
4 | |
5 $root = $dom->createElement('cds'); | |
6 $dom->appendChild($root); | |
7 | |
8 mysql_connect("localhost","root",""); | |
9 mysql_select_db("cdcol"); | |
10 | |
11 $result=mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;"); | |
12 | |
13 while( $row=mysql_fetch_array($result) ) | |
14 { | |
15 $cd = $dom->createElement('cd'); | |
16 $cd->setAttribute('id', $row['id']); | |
17 | |
18 $titel = $dom->createElement('titel'); | |
19 $titel->appendChild($dom->createTextNode($row['titel'])); | |
20 $cd->appendChild($titel); | |
21 | |
22 $interpret = $dom->createElement('interpret'); | |
23 $interpret->appendChild($dom->createTextNode($row['interpret'])); | |
24 $cd->appendChild($interpret); | |
25 | |
26 $jahr = $dom->createElement('jahr'); | |
27 $jahr->appendChild($dom->createTextNode($row['jahr'])); | |
28 $cd->appendChild($jahr); | |
29 | |
30 $root->appendChild($cd); | |
31 } | |
32 | |
33 header("Content-Type: text/xml;"); | |
34 print $dom->saveXML(); | |
35 ?> |