Hi i've sorted it now i believe. Not sure why it wouldnt work in the file previous to using the map, i manually input the GET variables in. But using the map it was fine. I appreciate the help though. I will almost certainly be back. ha
Thanks again On Aug 25, 8:46 pm, "[email protected]" <[email protected]> wrote: > On Aug 25, 12:07 pm, Jonathon <[email protected]> wrote: > > > > > Hello, > > > I'm still very new to using google maps but it does seem pretty damn > > ace. I've already completed working with google mpas/php/mysql with a > > little bit of help i may add. > > > I xml output for this tutorial isnt quite working. I can only seem to > > echo out the end tag: > > > "<markers/>" > > > I'm not exactly sure why, I will post my code below. I connect to my > > db in a seperate file and that is working i did a quick test and > > called all the rows and it pulled back a mysql_num_rows of 169. > > > My code is: > > > "<?php > > require("connect_google.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); > > > // Search 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()); > > > } > > > 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("address", $row['address']); > > $newnode->setAttribute("lat", $row['lat']); > > $newnode->setAttribute("lng", $row['lng']); > > $newnode->setAttribute("distance", $row['distance']); > > > } > > > echo $dom->saveXML(); > > ?> > > " > > > I'd appreciate it if anyone could help me out, as i said i'm brand new > > to google maps and also xml really in this sense. > > I would say that there is no data in your database that meets the > query criteria. What query string did you use? Is there any data in > the database that matches? You might try a query with a radius that > includes the whole world and see if it returns any results. > > If you give us a link to the xml feed or your map, we might be able to > help more. > > -- Larry > > > > > Thanks > > > Jonathon -- 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.
