XML creation using DOM and MYSQL
        Posted  
        
            by dbomb101
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dbomb101
        
        
        
        Published on 2010-03-22T14:49:59Z
        Indexed on 
            2010/03/22
            14:51 UTC
        
        
        Read the original article
        Hit count: 438
        
I am trying to create a XML document from information extracted from a mysql table. I am using a tutorial to accomplish this
http://www.tonymarston.net/php-mysql/dom.html#a5
what I want to do is to create each element separately, instead of creating them all at once as shown in the tutorial. In order to do that I am trying to place the specific field name into the foreach loop below, any help would be greatly appreciated.
foreach ($row as where fieldname should go  => $row['artistname'])
  {
  $artval = $doc->createTextNode($row['artistname']);
  $artval = $chil->appendChild($val);
  }
© Stack Overflow or respective owner