o, and also, this is the code for my phpsqlsearch_genxml.php

<?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"];
$name = $_GET["name"];
$address = $_GET["address"];



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


    // do your existing query
        $query = sprintf("SELECT name, address,  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";

?>


On Aug 4, 10:56 am, opusrandy <opusra...@gmail.com> wrote:
> ok, i have made previous posts, but since then i have made significant
> progress. But i am in desperate need of a final push to get this thing
> functioning. In order for anyone to help me, this post will be very
> elaborate, and im gonna try to give you all the information that i can
> so that there wont be any secondary questioning, gonna try to lay it
> out on the table right now...
>
> As stated in my previous posts, we are working with this page...(right
> now we are only on this alabama page, when it is working we will
> implement the code onto the pages for all the other states.)
>
> http://wesco.jp-clients.com/branch_locate/branch_lists/alabama.php
>
> The code that calls all the branch information goes like this...
>
> <?
> $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` =
> 'AL' ORDER BY name asc");
> ?>
>
> and it is posted with this.....
>
> <h4>WESCO Branches - Alabama, United States of America</h4>
> <?
> while ($row = mysql_fetch_array($result)){
> //store the retrieved info as variables...
> $name = $row['name'];
> $address = $row['address'];
> $phone = $row['phone'];
> $fax = $row['fax'];
> $company = $row['company'];
> $lat = $row['lat'];
> $lng = $row['lng'];
>
> echo
> "<p class='branches_list'>
> <a href='http://wesco.jp-clients.com/branch_locate/index.php?lat=
> $lat&lng=$lng&zoom=7&type=h&address=$address'><strong>$name</strong></
> a><br/>
> <strong>Address:</strong>  $address<br/>
> <strong>Branch ID:</strong>  $branch_id<br/>
> <strong>Phone:</strong> $phone - <strong>Fax:</strong> $fax<br/>
> <strong>Company:</strong> $company
> </p>";}
>
> //close server connection...
> mysql_close($link);
> ?>
>
> NOW.....if you click the link for 'birmingham' for example, you can
> see what im trying to do. We want the user to click the title of the
> branch, and have that direct them to the API page with ONLY THAT
> BRANCH being displayed. As you can see i am about 3/4 of the way
> there. I have it reading in the lat and lng from the url, and it jumps
> directly to that branch on the map page.
>
> ...what im having problems with now, is getting the sidebar and marker
> 'bubble' to show up with the information in it. So far all Im getting
> is the marker and the overall area that the branch is in, but no
> sidebar or marker 'popup bubble'. here's my javascript that is making
> this all happen so far....
>
>                     var map;
>             var geocoder;
>
>     function load() {
>       if (GBrowserIsCompatible()) {
>         map = new GMap2(document.getElementById('map_wesco'));
>         map.addControl(new GSmallMapControl());
>         map.addControl(new GMapTypeControl());
>         map.setCenter(new GLatLng(<?php echo $lat; ?>,<?php echo
> $lng; ?>), 10);
>                 map.addOverlay(createMarker(new GLatLng(<?php echo $lat; ?>, 
> <?php
> echo $lng; ?>), 'address')) ;
>       }
>     }
>
>        function createMarker(point, text) {
>                         var marker = new GMarker(point);
>                         GEvent.addListener(marker, "click", function() {
>                         marker.openInfoWindowHtml(text);
>                 });
>
> //     marker.openInfoWindowTabsHtml(text);
>
>           return marker;
>
>         }
>
> NOW...before someone says "well its not creating a sidebar because you
> dont have that function in the javascript".....know that i am aware of
> that, and its not in there so that you guys can see how its
> functioning...WHEN I DO put the CreateSideBar function in there...it
> shuts down the whole map. I think this is because the default sidebar
> is being created based on what the user SEARCHES for, but here, we
> would like that information to be passed through the url perhaps. Can
> anybody help me finish this thing up? i've tried everything, I could
> use some code assistance.
>
> (note: if your just going to post me links other posts, make sure it
> is absolutely 100% relevant to what im trying to do, because im
> already super confused as it is.)
>
> HEEEELP!!!
>
> Randy Kettering
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to Google-Maps-API@googlegroups.com
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to