Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing XML to a google map to create multiple markers
    text
    copied!<p>Hello Ladies and Gents,</p> <p>Todays issue is this:</p> <pre><code> GDownloadUrl("http://www.mysite/map.php", function(data) { var xml = GXml.parse(data); //var markers = xml.documentElement.getElementsByTagName("marker"); //for (var i = 0; i &lt; markers.length; i++) { //var address = new GLatLng(parseFloat(markers[i].getAttribute("location"))); //var latlong = address.split(","); //var latlongtomap = new GLatLng(parseFloat(latlong[0]), parseFloat(latlong[1])); var latlongtomap = new GLatLng(51.477711,-3.176555); var marker = createMarker(latlongtomap); map.addOverlay(marker); // } }); } } </code></pre> <p>If I run this it will get the Lat and Long coords and create a marker on a map for me. However, if I attempt to get the "location"tab from my php script (using all the commented out code):</p> <p>map.php</p> <pre><code>&lt;?php mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); $query = "SELECT MAPADDRESS FROM report"; $result = mysql_query($query) or die(mysql_error()); $doc = new DomDocument('1.0'); $node = $doc-&gt;createElement("markers"); $parnode = $doc-&gt;appendChild($node); header("Content-type: text/xml"); while($row = mysql_fetch_array($result)){ $node = $doc-&gt;createElement("marker"); $newnode = $parnode-&gt;appendChild($node); $newnode-&gt;setAttribute("location", $row['MAPADDRESS']); } print $doc-&gt;saveXML(); ?&gt; </code></pre> <p>results of this are: </p> <pre><code>&lt;markers&gt; &lt;marker location="51.477711,-3.176555"/&gt; &lt;marker location="51.472512,-3.187527"/&gt; &lt;marker location="51.471057,-3.186263"/&gt; &lt;marker location="51.473261,-3.192219"/&gt; &lt;/markers&gt; </code></pre> <p>Why will the code not read this php properly?</p> <p>Thanks for your help!! </p> <p>Hemm</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload