view _xampp/contrib/dom.php @ 16:fb948097de39

fix bug: Edittaglist is working on Firefox. fix bug: name of regex used to show with strange <span id="transmark"></span> showing only on FF but not Saf. Change it to use "document.getElementById(id).textContent to get the pure text string.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 20 Feb 2015 16:39:08 +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();
?>