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 675607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:50:12+00:00 2026-05-14T00:50:12+00:00

Update 2 : So I never have used the debug function in firebug, but

  • 0

Update 2: So I never have used the debug function in firebug, but I just looked at the script section and I get this, now I will try and figure this out.

Failed to load source for:
http://localhost/googleMap/phpsqlajax_genxml.php

Hiya,

I followed this tutorial below
http://code.google.com/apis/maps/articles/phpsqlajax_v3.html#outputxml

I ran into trouble, near then end, I am hoping someone else here has
got this working and can help me discover my problem. Simply there are 4
steps to this tutorial

  • Creating the Table
  • Populating the Table
  • Outputting XML with PHP
  • Creating the Map

I successfully have completed all the steps, however the outputted xml
isn’t read by the google map I created. The files are all on the same
directory, and I didn’t change any of the file names from the
tutorial. The tutorial has a step to test if the php file called
phpsqlajax_genxml.php is outputting the xml and I successfully tested
it and it was.

The problem is that the map isn’t rendering the items I have in the
database, that should be converted to xml for the map to read.

Any help, or pointing me in the right direction would be much
appreciated.

UPDATE 1: I realize I don’t have any code to show here, there are just 3 files so I am not sure which will be of the best use. I Have a question that might help my issue though.

In the xml output part of the tutorial I am asked too

Call this PHP script from the browser
to make sure it’s producing valid XML.
If you suspect there’s a problem with
connecting to your database, you may
find it easier to debug if you remove
the line in the file that sets the
header to the text/xml content type,
as that usually causes your browser to
try to parse XML and may make it
difficult to see your debugging
messages.

This is the phpsqlajax_dbinfo.php file

<?php
$username="root";
$password="root";
$database="root-googleMap";
?>

This is the code for the generate xml, Is a xml document actually made after and can I open in, or is it temporary conversion. If so How do i do the step above to test, I dont really understand.

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

// Start XML file, create parent node
$doc = domxml_new_doc("1.0");
$node = $doc->create_element("markers");
$parnode = $doc->append_child($node);

// Opens a connection to a mySQL server
$connection=mysql_connect (localhost, $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());
}

// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 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 = $doc->create_element("marker");
  $newnode = $parnode->append_child($node);

  $newnode->set_attribute("name", $row['name']);
  $newnode->set_attribute("address", $row['address']);
  $newnode->set_attribute("lat", $row['lat']);
  $newnode->set_attribute("lng", $row['lng']);
  $newnode->set_attribute("type", $row['type']);
}

$xmlfile = $doc->dump_mem();
echo $xmlfile;

?>
  • 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-14T00:50:12+00:00Added an answer on May 14, 2026 at 12:50 am

    I’m assuming (and hoping) you’re not using PHP 4 anymore and that this is the source of your problem, the functions relating to the DOM XML manipulation have been replaced with the DOMDocument class, which has different method names.

    As such, I have refactored your code to be compatible with PHP 5:

    <?php
    require("phpsqlajax_dbinfo.php");
    
    // Start XML file, create parent node
    $doc = new DOMDocument("1.0");
    $node = $doc->createElement("markers");
    $parnode = $doc->appendChild($node);
    
    // Opens a connection to a mySQL server
    $connection=mysql_connect (localhost, $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());
    }
    
    // Select all the rows in the markers table
    $query = "SELECT * FROM markers WHERE 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 = $doc->createElement("marker");
      $newnode = $parnode->appendChild($node);
    
      $newnode->set_attribute("name", $row['name']);
      $newnode->set_attribute("address", $row['address']);
      $newnode->set_attribute("lat", $row['lat']);
      $newnode->set_attribute("lng", $row['lng']);
      $newnode->set_attribute("type", $row['type']);
    }
    
    echo $doc->saveXML();
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 351k
  • Answers 351k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Add a reference to ReachFramework.dll, and use the System.Windows.Xps.Packaging namespace May 14, 2026 at 7:11 am
  • Editorial Team
    Editorial Team added an answer You want to use LIMIT: SELECT * FROM table WHERE… May 14, 2026 at 7:10 am
  • Editorial Team
    Editorial Team added an answer Thanks - that was the way to go, to keep… May 14, 2026 at 7:10 am

Related Questions

When I add a breakpoint and hit F5 to run in the debugger (I
I encountered an interesting thing today that I have never noticed before. It appears
Ok now I am confused. I have been getting advice from SO users on
At my place of work I've been put in charge of creating a coding
Like most laptops, mine (a Dell Inspiron 1420) has a small button which can

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.