note 106610 rejected from book.simplexml by danbrown
| From: | danbrown@php.net | Date: | Tue, 29 Nov 2011 15:57:30 +0000 |
| Subject: | note 106610 rejected from book.simplexml by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184802@lists.php.net to get a copy of this message | ||
Note Submitter: dj_inti007 at hotmail dot com
----
Anyone please can help me out in giving me the code for archiving static data(for example playground
and matches already played) from sql and store it in xml file.
I make use of Query2XML but still it doesn't work
it display error and strict standard.
Here is the code i written.
<?php
// include required files
require_once 'XML/Query2XML.php';
require_once 'MDB2.php';
try {
// initalize Query2XML object
$q2x = XML_Query2XML::factory(MDB2::factory('mysql://root:pass@localhost/mis'));
// generate SQL query
// get results as XML
$sql = "SELECT * FROM footballmatches";
$xml = $q2x->getXML($sql, array(
'idColumn' => 'playground',
'rootTag' => 'matches',
'rowTag' => 'match',
'elements' => array('playground', 'opponent',
'date','time','homeAway','team','sponsor')
)
);
// send output to browser
header('Content-Type: text/xml');
$xml->formatOutput = true;
echo $xml->saveXML();
} catch (Exception $e) {
echo $e->getMessage();
}
?>