Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6563505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:51:35+00:00 2026-05-25T13:51:35+00:00

I’m having a little trouble with a query I’ve written (please see below). <?php

  • 0

I’m having a little trouble with a query I’ve written (please see below).

<?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(); 

?>

When I run the php script through my web browser it retrieves the correct data, but when I run this through the HTML page I get an ‘Out of Stack’ error. From what I’ve read on the web, I think it may be because the SQL query is too complex.

Could you tell me please can an overly complex SQL query cause this type of error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:51:36+00:00Added an answer on May 25, 2026 at 1:51 pm

    There’s something wrong/unexpected with your data.

    1) Do a file_put_contents(“somedumpfile”, var_export($row, true)) at the top of each loop, and see what’s in the file after the process dies.
    2) If that didn’t help, then systematically remove one field at a time from being added as a node, from top to bottom. When you stop getting the error, you found the culprit.
    3) If that still didn’t help, start re-adding the fields as nodes, from top to bottom.

    Make sure the PHP error-log is fully enabled and see if PHP is complaining about anything else. Also think about dumping the row index and PHP’s current memory consumption (memory_get_usage) into that same file.

    Good luck. Share your results.

    (Vote me up if you like/accept this answer.)

    Dustin

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm parsing an XML file, the creators of it stuck in a bunch social
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.