With the code mentioned above and in relation to a MSSQL query.
When using the following statements to retrieve dat "fetch_assoc" then running a split statement PHP it then into a array it will not pass the data retrieved will show correctly in a XML document created by the DOM object.
<?php
require("phpsqlajax_dbinfo.php");
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
$connection=mssql_connect ("ELF\ELF", $username, $password);
if (!$connection) {
die('Not connected : ' . mssql_error());
}
$db_selected = mssql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mssql_error());
}
$query = "SELECT msg FROM ozekimessagein ORDER BY senttime DESC";
$result = mssql_query($query);
if (!$result) {
die('Invalid query: ' . mssql_error());
}
header("Content-type: text/xml");
while ($row = @mssql_fetch_assoc($result)) {
list ($vehicleID,$long,$lat) = split(',',$row);
$node = $dom->createElement("marker");
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("VehicleID:",$vehicleID);
$newnode->setAttribute("lat",$lat);
$newnode->setAttribute("long",$long);
}
echo $dom->saveXML();
?>
Merlinman