Note that there are some explanatory texts on larger screens.

plurals
  1. POToo Much Recursion
    text
    copied!<p>I'm having problems in trying to run an HTML Google Map form. Everytime I try and run it I get the following message 'Stack overflow at line: 26', then when I click ok I get 'Stack overflow at line: 28'. This isn't the most helpful of error messages so I've run it thorugh Firebug and it tells me that there is 'Too much recursive' in main.js. Again I haven't a clue what this means</p> <p>I've listed my PHP script and HTML form below.</p> <p><strong>PHP Code</strong></p> <pre><code>&lt;?php require("phpfile.php"); // Start XML file, create parent node $dom = new DOMDocument("1.0"); $node = $dom-&gt;createElement("markers"); $parnode = $dom-&gt;appendChild($node); // Opens a connection to a MySQL server $connection=mysql_connect ("hostname", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error());} // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } $query = "SELECT finds.userid, finds.findid, finds.locationid, finds.findosgb36lat, finds.findosgb36lon, finds.detectorid, detectors.detectorid, detectors.detectorname, finds.searchheadid, searchheads.searchheadid, searchheads.searchheadname, FROM finds, detectors, searchheads WHERE finds.detectorid=detectors.detectorid AND finds.searchheadid=searchheads.searchheadid AND `locationid` = '52' 'userid'='1'"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $node = $dom-&gt;createElement("marker"); $newnode = $parnode-&gt;appendChild($node); $newnode-&gt;setAttribute("userid",$row['userid']); $newnode-&gt;setAttribute("findid",$row['findid']); $newnode-&gt;setAttribute("locationid",$row['locationid']); $newnode-&gt;setAttribute("detectorname",$row['detectorname']); $newnode-&gt;setAttribute("searchheadname",$row['searchheadname']); } echo $dom-&gt;saveXML(); ?&gt; </code></pre> <p><strong>HTML Form</strong></p> <pre><code>&lt;script type="text/javascript"&gt; function load() { var map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng(54.312195845815246,-4.45948481875007), zoom:14, mapTypeId: 'satellite' }); var infoWindow = new google.maps.InfoWindow; downloadUrl("loadfindsperlocation.php", function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); var bounds = new google.maps.LatLngBounds(); for (var i = 0; i &lt; markers.length; i++) { var locationid = markers[i].getAttribute("locationid"); var detectorname = markers[i].getAttribute("detectorname"); var searchheadname = markers[i].getAttribute("searchheadname"); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("findosgb36lat")), parseFloat(markers[i].getAttribute("findosgb36lon"))); var marker = new google.maps.Marker({ map: map, position: point, formdetectorname: detectorname, formsearchheadname: searchheadname, }); bounds.extend(point); map.fitBounds(bounds); bindInfoWindow(marker, map, infoWindow, html); google.maps.event.addListener(marker, "click", function() { document.getElementById('detectorname').value = this.formdetectorname; document.getElementById('searchheadname').value = this.formsearchheadname; }); } }); } function bindInfoWindow(marker, map, infoWindow, html) { google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(html); infoWindow.open(map, marker); }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} &lt;/script&gt; &lt;/head&gt; &lt;form name="findsperlocation" id="findsperlocation"&gt; FORM FIELDS APPEAR HERE &lt;/form&gt; &lt;body onLoad="load()"&gt; &lt;div id="map"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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