<?php
mysql_connect('localhost', 'root', 'admin');
mysql_select_db('xml');
$sql = "SELECT udid, country,code FROM country ORDER BY udid";
$res = mysql_query($sql);
$xml = new XMLWriter();
$xml->openURI("php://output");
$xml->startDocument();
$xml->setIndent(true);
$xml->startElement('countries');
while ($row = mysql_fetch_assoc($res)) {
$xml->startElement("udid");
$xml->writeRaw($row['udid']);
$xml->endElement();
$xml->startElement("country");
$xml->writeAttribute('udid', $row['udid']);
$xml->writeRaw($row['country']);
$xml->endElement();
$xml->startElement("code");
$xml->writeRaw($row['code']);
$xml->endElement();
}
$xml->endElement();
header('Content-type: text/xml');
$xml->flush();
?>
mysql_connect('localhost', 'root', 'admin');
mysql_select_db('xml');
$sql = "SELECT udid, country,code FROM country ORDER BY udid";
$res = mysql_query($sql);
$xml = new XMLWriter();
$xml->openURI("php://output");
$xml->startDocument();
$xml->setIndent(true);
$xml->startElement('countries');
while ($row = mysql_fetch_assoc($res)) {
$xml->startElement("udid");
$xml->writeRaw($row['udid']);
$xml->endElement();
$xml->startElement("country");
$xml->writeAttribute('udid', $row['udid']);
$xml->writeRaw($row['country']);
$xml->endElement();
$xml->startElement("code");
$xml->writeRaw($row['code']);
$xml->endElement();
}
$xml->endElement();
header('Content-type: text/xml');
$xml->flush();
?>