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.                 'sql_options' => array(
  30.                     'uncached'      => true,
  31.                     'single_record' => false,
  32.                     'merge'         => false,
  33.                     'merge_master'  => false
  34.                 ),
  35.                 'rootTag' => 'albums',
  36.                 'rowTag' => 'album',
  37.                 'idColumn' => 'albumid',
  38.                 'elements' => array(
  39.                     'albumid',
  40.                     'title',
  41.                     'published_year',
  42.                     'comment'
  43.                 )
  44.             )
  45.         )
  46.     )
  47. );
  48.  
  49. header('Content-Type: application/xml');
  50.  
  51. $dom->formatOutput = true;
  52. print $dom->saveXML();
  53. ?>

Documentation generated on Mon, 11 Mar 2019 14:56:24 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.