ok...this makes sense and i understand what your saying...but im still
confused as to what code I would have to implement and where? Not too
crafty at php, but I can be dangerous with certain aspects of it.
would I add it into my phpsqlsearch_genxml.php file? the file consists
of this...

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

// 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 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 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";

?>


so would i insert this?....

$branch_id = $_GET["branch_id"];

I would have to add a branch_id field to my db, but after that, would
this work?



On Jul 23, 12:41 pm, Andrew Leach <[email protected]>
wrote:
> On Jul 23, 5:26 pm,opusrandy<[email protected]> wrote:
>
>
>
> >http://wesco.jp-clients.com/branch_locate/index.php
>
> > When you get to that page, it will display the branch you selected and
> > that branch ONLY.
> > This is the google maps API system that I have already set up. It's
> > running off of a database flawlessly as is. I need to find a way, to
> > pass a URL VARIABLE from the STATIC page to the page with my API
> > system on it to display the branch that the user selected.
>
> That's a PHP question, I think? It's called a querystring and is
> denoted with a question mark:
>
> index.php?branch_id=45678
>
> Your PHP script can get that branch_id with $_GET['branch_id'], do its
> database queries and build the page accordingly. It does mean that
> your static page needs to build the URLs like that.
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
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