Jump to content

need help with Google Maps API


svgmx5

Recommended Posts

Hey everyone

 

i'm working with google maps and i'm having a small problem...

 

the problem is that i have records on my database that i'm echoing using php and mysql and i want to display those items on the map as well. I have the lat and lon of them .

 

The problem is that i also want the users to search for the items and then those items will be displayed based on what the user searched for however i'm using some code from google maps API sample code gallery and i'm having problems parsin the values from the form to the seperate script that displays them results in XML format

 

This is the script i'm suing

 

http://code.google.com/apis/maps/articles/phpsqlajax_v3.html

 

And below i have the code


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

?>

 

Obviously i'm  using my own rows and info.

 

So my question is how can i get the post variables from the form which are stored in one page to get them to echo in the page above with the script so it can search for the values

 

I've tried using $_SESSION[] but its not wokrking, nothing is being parsed, and yes i did add session_start() at the top of the page

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.