I'm trying to write some locations into an xml file in order to use them later it was working until I decide to use explode it gives me then an error which is:"error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error."Here is the code:
<?php
$conn=mysqli_connect("localhost", "thecode007", "007","offers") or die(mysql_error());
$query = "SELECT * FROM Branches";
$result = mysqli_query($conn,$query) or die(mysql_error());
$doc = new DomDocument('1.0');
$node = $doc->createElement("markers");
$parnode = $doc->appendChild($node);
header("Content-type: text/xml");
while($row = mysqli_fetch_array($result))
{
$node = $doc->createElement("marker");
$newnode = $parnode->appendChild($node);
$loc=explode(",",$row);
$newnode->setAttribute("location", $loc[0]);
}
print $doc->saveXML();
?>
</div>