Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 堆栈空间不足错误_Php_Mysql_Sql - Fatal编程技术网

Php 堆栈空间不足错误

Php 堆栈空间不足错误,php,mysql,sql,Php,Mysql,Sql,我写的一个查询有点问题(请参见下文) createElement(“标记”); $parnode=$dom->appendChild($node); //打开到MySQL服务器的连接 $connection=mysql\u connect(“主机名”、$username、$password); if(!$connection){die('notconnected:'.mysql_error());} //设置活动MySQL数据库 $db\u selected=mysql\u select\u d

我写的一个查询有点问题(请参见下文)

createElement(“标记”);
$parnode=$dom->appendChild($node);
//打开到MySQL服务器的连接
$connection=mysql\u connect(“主机名”、$username、$password);
if(!$connection){die('notconnected:'.mysql_error());}
//设置活动MySQL数据库
$db\u selected=mysql\u select\u db($database,$connection);
如果选择了(!$db_){
die('不能使用db:'.mysql_error());
} 
$query=“选择userdetails.userid
,detectinglocations.locationid
,detectinglocations.locationname
,findid
,查找.locationid
,finds.findosgb36lat
,finds.findosgb36lon
,找到.dateoftrip
,finds.findcategory
,finds.findname
,finds.finddescription
,查找.detectorsettings
,找到.pasref
,查找。其他注释
,detectors.detectorname
,searchheads.searchheadname
来自用户详细信息、检测位置、发现、检测器、搜索头
其中finds.userid=userdetails.userid
并查找.locationid=检测位置.locationid
并查找。detectorid=检测器。detectorid
和搜索头。detectorid=探测器。detectorid“;
$result=mysql\u query($query);
如果(!$result){
die('无效查询:'.mysql_error());
} 
标题(“内容类型:text/xml”);
//遍历行,为每个行添加XML节点
而($row=@mysql\u fetch\u assoc($result)){
//添加到XML文档节点
$node=$dom->createElement(“标记”);
$newnode=$parnode->appendChild($node);
$newnode->setAttribute(“findid”,$row['findid']);
$newnode->setAttribute(“locationid”,$row['locationid']);
$newnode->setAttribute(“locationname”,$row['locationname']);
$newnode->setAttribute(“dateoftrip”,$row['dateoftrip']);
$newnode->setAttribute(“findcategory”,$row['findcategory']);
$newnode->setAttribute(“findname”,$row['findname']);
$newnode->setAttribute(“finddescription”,$row['finddescription']);
$newnode->setAttribute(“detectorname”,$row['detectorname']);
$newnode->setAttribute(“searchheadname”,$row['searchheadname']);
$newnode->setAttribute(“detectorsettings”,$row['detectorsettings']);
$newnode->setAttribute(“pasref”,$row['pasref']);
$newnode->setAttribute(“additionalcomments”,$row['additionalcomments']);
} 
echo$dom->saveXML();
?>
当我通过web浏览器运行php脚本时,它会检索正确的数据,但当我通过HTML页面运行该脚本时,会出现“堆栈外”错误。从我在网上读到的内容来看,我认为这可能是因为SQL查询太复杂了


您能否告诉我,过于复杂的SQL查询是否会导致此类错误?

您的数据有问题/意外

1) 在每个循环的顶部放置文件内容(“somedumpfile”,var\u export($row,true)),并在进程结束后查看文件中的内容。 2) 如果这样做没有帮助,那么从上到下,一次系统地删除一个作为节点添加的字段。当你不再犯错误时,你找到了罪魁祸首。 3) 如果仍然没有帮助,开始从上到下重新添加字段作为节点

确保PHP错误日志已完全启用,并查看PHP是否在抱怨其他问题。还可以考虑将行索引和PHP的当前内存消耗(memory_get_usage)转储到同一个文件中

祝你好运。分享你的结果

(如果你喜欢/接受这个答案,请投我一票。)


Dustin

PHP是一种服务器端语言,因此我无法理解“通过web浏览器”和“尽管HTML页面”在本文中的含义以及它们之间的区别。查询肯定不太复杂。你的代码一次只处理一行,你知道每次获取的数据量是有限的。嗨,非常感谢你回复我的帖子。我理解PHP是基于服务器的,但是通过使用PHP文件名并将其输入web浏览器的地址框,您可以看到从“后端”提取的数据。这显然不同于使用html表单作为web地址。我希望这有意义?你好,克里斯
<?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 userdetails.userid
                 , detectinglocations.locationid
                 , detectinglocations.locationname
                 , finds.findid
                 , finds.locationid
                 , finds.findosgb36lat
                 , finds.findosgb36lon
                 , finds.dateoftrip
                 , finds.findcategory
                 , finds.findname
                 ,finds.finddescription
                 , finds.detectorsettings
                 , finds.pasref
                 , finds.additionalcomments
                 , detectors.detectorname
                 , searchheads.searchheadname 
          FROM userdetails, detectinglocations, finds, detectors, searchheads 
          WHERE finds.userid=userdetails.userid 
            AND finds.locationid=detectinglocations.locationid 
            AND finds.detectorid=detectors.detectorid 
            AND searchheads.detectorid=detectors.detectorid"; 

$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("findid",$row['findid']); 
$newnode->setAttribute("locationid",$row['locationid']); 
$newnode->setAttribute("locationname",$row['locationname']); 
$newnode->setAttribute("dateoftrip",$row['dateoftrip']); 
$newnode->setAttribute("findcategory",$row['findcategory']); 
$newnode->setAttribute("findname",$row['findname']); 
$newnode->setAttribute("finddescription",$row['finddescription']); 
$newnode->setAttribute("detectorname",$row['detectorname']); 
$newnode->setAttribute("searchheadname",$row['searchheadname']); 
$newnode->setAttribute("detectorsettings",$row['detectorsettings']);
$newnode->setAttribute("pasref",$row['pasref']);
$newnode->setAttribute("additionalcomments",$row['additionalcomments']);
} 

echo $dom->saveXML(); 

?>