简体   繁体   English

太多的递归

[英]Too Much Recursion

I'm having problems in trying to run an HTML Google Map form. 我在尝试运行HTML Google地图表单时遇到问题。 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'. 每次我尝试运行它时,我得到以下消息'Stack overflow at line:26',然后当我点击ok时,我得到'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. 这不是最有用的错误消息,所以我运行它来看看Firebug它告诉我main.js中有“Too much recursive”。 Again I haven't a clue what this means 我再也不知道这意味着什么

I've listed my PHP script and HTML form below. 我在下面列出了我的PHP脚本和HTML表单。

PHP Code PHP代码

<?php 
require("phpfile.php"); 

// Start XML file, create parent node 

$dom = new DOMDocument("1.0"); 
$node = $dom->createElement("markers"); 
$parnode = $dom->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->createElement("marker"); 
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("userid",$row['userid']); 
$newnode->setAttribute("findid",$row['findid']); 
$newnode->setAttribute("locationid",$row['locationid']); 
$newnode->setAttribute("detectorname",$row['detectorname']);
$newnode->setAttribute("searchheadname",$row['searchheadname']);
} 

echo $dom->saveXML(); 

?>

HTML Form HTML表单

<script type="text/javascript"> 
    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 < 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() {} 

</script> 
</head>  
          <form name="findsperlocation" id="findsperlocation">
            FORM FIELDS APPEAR HERE
          </form>  
          <body onLoad="load()">
          <div id="map"></div>
            </body> 
            </html>

All, I've solved the problem. 总之,我已经解决了这个问题。 When I was looking at Firebug the error, it kept mentioning the 'gstatic' files which I know are to do with the Lat and Lng co-ordinates. 当我看着Firebug的错误时,它不断提到'gstatic'文件,我知道这些文件与Lat和Lng坐标有关。

It got me thinking to what I had done recently and I realised that for testing purposes I had just keyed in one set of the Lat and Lng co-ordinates which were obviously wrong. 它让我思考我最近所做的事情,并且我意识到,出于测试目的,我只是键入了一组Lat和Lng坐标,这显然是错误的。 Apologies to all for the time and effort you put in to help. 向所有人致歉,您需要投入时间和精力来提供帮助。 Kind regards Chris 亲切问候克里斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM