Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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
        LEFT JOIN album ON album.artist_id = artist.artistid
11
     ORDER BY
12
        artist.artistid,
13
        album.albumid",
14
    array(
15
        'rootTag' => 'music_library',
16
        'rowTag' => 'artist',
17
        'idColumn' => 'artistid',
18
        'elements' => array(
19
            'artistid',
20
            'name',
21
            'birth_year',
22
            'birth_place',
23
            'genre',
24
            'albums' => array(
25
                'rootTag' => 'albums',
26
                'rowTag' => 'album',
27
                'idColumn' => 'albumid',
28
                'elements' => array(
29
                    'albumid',
30
                    'title',
31
                    'published_year',
32
                    'comment'
33
                )
34
            )
35
        )
36
    )
37
);
38
 
39
header('Content-Type: application/xml');
40
 
41
$dom->formatOutput = true;
42
print $dom->saveXML();
43
?>