ok....here's the scoop.....

first, i have my branch locator functioning off of a database right
here....

http://wesco.jp-clients.com/branch_locate/index.php

Right now, you can search a territory or zip code, and find branches
within the selected radius....

Our goal is to have the user start on this page....

http://wesco.jp-clients.com/branch_locate/branch_lists/branch_list.php

When they click a state or province, it will take them to one of these
pages, alabama for example....

http://wesco.jp-clients.com/branch_locate/branch_lists/alabama.php

Then from here, we want the user to be able to click the bold
highlighted name of the branch above the address...and pass them to
the API page based on branch_id

my database tables are as follows...

id, name, branch_id, address, state,  phone, fax, company, lat, lng

on the individual state pages, the query that pulls in the info for
that area is as follows....

<?
$link = mysql_connect ($h, $u, $p) or die ("Could not connect to
database, try again later");
mysql_select_db($d, $link);

$result = mysql_query("SELECT * from `markers_csv` where `state` =
'UT' ORDER BY name asc");
?>

I have the branch_id field in my database....can anyone help me write
the function that would shoot my users from this page...

http://wesco.jp-clients.com/branch_locate/branch_lists/alabama.php

to this page...

http://wesco.jp-clients.com/branch_locate/index.php

and have it pull up the location in the map based on branch_id?

here is the code that pulls in my map stuff from the db

<?php
//header("Content-type: text/xml");
require("dbinfo.php");

function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','&lt;',$htmlStr);
$xmlStr=str_replace('>','&gt;',$xmlStr);
$xmlStr=str_replace('"','&quot;',$xmlStr);
$xmlStr=str_replace("'",'&#39;',$xmlStr);
$xmlStr=str_replace("&",'&amp;',$xmlStr);
return $xmlStr;
}

// Get parameters from URL
$center_lat = $_GET["lat"];
$center_lng = $_GET["lng"];
$radius = $_GET["radius"];
$branch_id = $_GET["branch_id"];


// 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 = sprintf("SELECT branch_id, address, name, lat, lng, ( 3959 *
acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians
( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians
( lat ) ) ) ) AS distance FROM markers_csv HAVING distance < '%s'
ORDER BY distance LIMIT 0 , 20",
  mysql_real_escape_string($center_lat),
  mysql_real_escape_string($center_lng),
  mysql_real_escape_string($center_lat),
  mysql_real_escape_string($radius));

$result = mysql_query($query);
if (!$result) {
  die('Invalid query: ' . mysql_error());
}

// Start XML file, echo parent node
echo "<markers>\n";
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
  // ADD TO XML DOCUMENT NODE
  echo '<marker ';
  echo 'name="' . parseToXML($row['name']) . '" ';
  echo 'address="' . parseToXML($row['address']) . '" ';
  echo 'lat="' . $row['lat'] . '" ';
  echo 'lng="' . $row['lng'] . '" ';
  echo 'distance="' . $row['distance'] . '" ';
  echo "/>\n";
}

// End XML file
echo "</markers>\n";

?>


ps, i had previously posted something about this, but needed to get
more work done on it in the mean time, any help would be
apprecaiated!!!!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to