On Jan 21, 11:41 am, Matt <[email protected]> wrote: > hey all I followed this tutorial for a store > locator:http://code.google.com/apis/maps/articles/phpsqlsearch_v3.html > > I was able to get it up and running no problems. > > I tried to add a 'link' field to the popups but am having troubles > figuring it out. > > here is the mysql table > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Frankie Johnnie & Luigo Too','www.google.com','939W El Camino Real, > Mountain View, CA','37.386339','-122.085823'); > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Amici\'s East Coast Pizzeria','www.yahoo.com','790Castro St, > Mountain View, CA','37.38714','-122.083235'); > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Kapp\'s Pizza Bar & Grill','www.bing.com','191Castro St, Mountain > View, CA','37.393885','-122.078916'); > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Round Table Pizza: Mountain View','www.msn.com','570N Shoreline > Blvd, Mountain View, CA','37.402653','-122.079354'); > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Tony & Alba\'s Pizza & Pasta','www.espn.com','619Escuela Ave, > Mountain View, CA','37.394011','-122.095528'); > INSERT INTO `markers` (`name`, `link`, `address`, `lat`, `lng`) VALUES > ('Oregano\'s Wood-Fired Pizza','www.cnn.com','4546El Camino Real, Los > Altos, CA','37.401724','-122.114646'); > > I made "link" a varchar similar to name + address. > > phpsqlsearch_genxml.php > <?php > require("phpsqlsearch_dbinfo.php"); > > // Get parameters from URL > $center_lat = $_GET["lat"]; > $center_lng = $_GET["lng"]; > $radius = $_GET["radius"]; > > // Start XML file, create parent node > $dom = new DOMDocument("1.0"); > $node = $dom->createElement("markers"); > $parnode = $dom->appendChild($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()); > > } > > // Search the rows in the markers table > $query = sprintf("SELECT address, name, link, 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()); > > } > > header("Content-type: text/xml"); > > // Iterate through the rows, adding XML nodes for each > while ($row = @mysql_fetch_assoc($result)){ > $node = $dom->createElement("marker"); > $newnode = $parnode->appendChild($node); > $newnode->setAttribute("name", $row['name']); > $newnode->setAttribute("link", $row['link']); > $newnode->setAttribute("address", $row['address']); > $newnode->setAttribute("lat", $row['lat']); > $newnode->setAttribute("lng", $row['lng']); > $newnode->setAttribute("distance", $row['distance']); > > } > > echo $dom->saveXML(); > ?> > > any suggestions on how to get this working? > url:http://www.concreteexchange.com/locator/ > > when I try to search nothing happens.
When I try to search it puts me in the middle of the pacific ocean. Your xml looks OK: http://www.concreteexchange.com/locator/phpsqlsearch_genxml.php?lat=37&lng=-122&radius=1000 Strange. -- Larry -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
