Hi Everyone,

I have integrated a Google Map on my website, which is working in good order.
The maps data such as location lat/lng is coming from database.

At present all the location markers are appearing on the map. I have a php page which draws out all the sql data and turns it into an xml domdocument which the map calls.
what I need help with is how I can the result list appearing beside the map and when a user select a result it to appear on the map.

Also a search form which will filter the result and display relevant markers.

I would like to thank you in advance for taking your time in looking at my problem and hope i get the response i need.

Thank you.

Recommended Answers

All 4 Replies


Do I understand correctly the the XML is requested with an AJAX call, then acted on client-side to build out/replace some section of the DOM?

If so, then you will need to post sample XML and give some idea of the HTML you want to build otherwise I could only describe the solution in the most general of terms - nothing better than an AJAX tutorial.


Heres the script

require("connect_db.php"); // Connect to the database

// Start XML file, create parent node

$dom = new DOMDocument("1.0");
$node = $dom->createElement("events");
$parnode = $dom->appendChild($node); 

// Select all the rows in the markers table

$query = "SELECT * FROM event INNER JOIN menu ON event.eid=menu.eid 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)){  
  $node = $dom->createElement("hostevent");  
  $newnode = $parnode->appendChild($node);   
  $newnode->setAttribute("address", $row['address']);  
  $newnode->setAttribute("eid", $row['eid']);  
  $newnode->setAttribute("lat", $row['lat']);  
  $newnode->setAttribute("lng", $row['lng']);  

echo $dom->saveXML();


You need to post :

  • A sample XML response, rather than the script that builds it
  • Sample HTML fragment(s) that need to be built from the XML response
  • The HTML fragment which will receive the built HTML fragment(s)

Then I can give you some help with writing the javascript to join up the parts.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.