FYI - have created a script to export data base to XML file
Hope this can be helpful to someone else.
<?php
// example of connection to a database
$hostname ="remotemysqlhost";
$username ="kenn3_caldlma";
$password ="paswrd";
$dbName = "kenn3_dlmcal";
$conn = mysql_connect($hostname,$username,$password);
mysql_select_db($dbName) or die("Could Not Connect To Database");
// example of querying your table
$query = "select id, startDate, endDate, title, descr, category from epc_calendar";
// example of getting results from query
$result = mysql_query($query,$conn);
if($result) {
// if query ran successfully
// loop over results
//open file to write to
$file_handle = fopen('events.xml','w');
// i normal remove this this line
$xmlPacket = "<?xml version='1.0'?>\n";
//----
$xmlPacket .="<newsblock>\n";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
// build xml to a variable
$xmlPacket .=
"\n<news>
<active>YES</active>
<id>".$row['id']."</id>
<startdate>".$row['startDate']."</startdate>
<enddate>".$row['endDate']."</enddate>
<title>".$row['title']."</title>
<descr>".$row['descr']."</descr>
<category>".$row['category']."</category>
</news> \n";
}
$xmlPacket .= '</newsblock>';
}
else{
// you probably want to remove this when you are putting this code live.
die('query failed' . mysql_error());
// you can replace it with this:
// which will just build an empty packet rather than killing the process
$xmlPacket = "<?xml version='1.0'?><calendar></calendar>";
}
// write var to file
fwrite($file_handle,$xmlPacket);
fclose($file_handle);
die('Done....');
?>