XML_Query2XML
[ class tree: XML_Query2XML ] [ index: XML_Query2XML ] [ all elements ]

Source for file case03.php

Documentation is available at case03.php

  1. <?php
  2. require_once 'XML/Query2XML.php';
  3. require_once 'MDB2.php';
  4. $query2xml XML_Query2XML::factory(MDB2::factory('mysql://root@localhost/Query2XML_Tests'));
  5. $dom $query2xml->getXML(
  6.     "SELECT
  7.         *
  8.      FROM
  9.         artist
  10.      ORDER BY
  11.         artistid",
  12.     array(
  13.         'rootTag' => 'music_library',
  14.         'rowTag' => 'artist',
  15.         'idColumn' => 'artistid',
  16.         'elements' => array(
  17.             'artistid',
  18.             'name',
  19.             'birth_year',
  20.             'birth_place',
  21.             'genre',
  22.             'albums' => array(
  23.                 'sql' => array(
  24.                     'data' => array(
  25.                         'artistid'
  26.                     ),
  27.                     'query' => 'SELECT * FROM album WHERE artist_id = ?'
  28.                 ),
  29.                 'rootTag' => 'albums',
  30.                 'rowTag' => 'album',
  31.                 'idColumn' => 'albumid',
  32.                 'elements' => array(
  33.                     'albumid',
  34.                     'title',
  35.                     'published_year',
  36.                     'comment'
  37.                 )
  38.             )
  39.         )
  40.     )
  41. );
  42.  
  43. header('Content-Type: application/xml');
  44.  
  45. $dom->formatOutput = true;
  46. print $dom->saveXML();
  47. ?>

Documentation generated on Mon, 11 Mar 2019 15:43:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.