I'm trying to place markers on a google map based on values filed in a mysql db. When loading the xml dynamically using PHP, no markers get placed on the map due to the responseXML.DocumentElement property not getting valued. It works when I load the XML from a static file, just not when dynamically loading from a db.
Here is the page that doesn't work: http://www.thirstygolfer.com/utils/maptest2.html
Here is the page that works: http://www.thirstygolfer.com/utils/maptest1.html
This is the PHP file generating the xml: www.thirstygolfer.com/utils/xmldump3.php
Here is the PHP code from thirstygolfer.com/utils/xmldump3.php (minus the db connection info):
<?php
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
$result=mysql_query("SELECT * FROM Main WHERE State='MA' and FirstLetter='A'");
header("Content-type: text/xml");
while ($row = mysql_fetch_assoc($result)){
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("id",$row['id']);
$newnode->setAttribute("lat", $row['Lat']);
$newnode->setAttribute("lng", $row['Lon']);
}
echo $dom->saveXML();
?>
Please help!!
The headers on the XML are not correct (from web-sniffer.net)
HTTP Response Header
Name Value Delim
Status: HTTP/1.1 200 OK
Date: Fri, 11 Jan 2013 18:38:04 GMT
P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
Content-Type: text/html
Age: 0
Connection: close
Server: YTS/1.19.11:
The Content-Type needs to be "text/xml"