Export and import mysql data/array into XML (File format Microsoft Excel XML 2003)
mysql_connect("localhost","root","");
mysql_select_db("cdcol");
$query = mysql_query("SELECT * FROM cds");
while($row = mysql_fetch_assoc($query)){
$data[] = $row;
}
header( "content-type: text/xml" );
require_once('phpXML.class.php');
$XML = new phpXML();
$XML->dataAry = $data;
$XML->generateXML();
echo $XML->getXML();
Add this two line
header('Content-disposition: attachment; filename="newfile.xml"');
header('Content-type: "text/xml"; charset="utf8"');
instead of
header( "content-type: text/xml" );
require_once('phpXML.class.php');
$XML = new phpXML();
$XML->xmlFileName = '1.xml';
$XML->xmlFilePath = './';
$XML->xmlFileUploadType = 'local';
$XML->readXML();
print_r($XML->getXMLObject());
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<button type="submit" name="submit">Read This XML Excel</button>
</form>
print_r($_FILES);
if(isset($_POST['submit']) && isset($_FILES['file']['name'])!=NULL){
require_once('phpXML.class.php');
$XML = new phpXML();
$XML->xmlFileUploadType = 'fly';
$XML->xmlFileName = $_FILES['file'];
$XML->readXML();
print_r($XML->getXMLObject());
}
=======