*Thanks for responding. You're right, mind reading isn't a lot of people's specialty. I try to read everything as it is laid out, but, for some reason, it is still not working. Like I said before, the php file works fine. Althoug, I am not sure if the XML is supposed to happen within that file, or create another file automatically on my server (which it's not). But, it's connecting, and retrieving from MySQL, when you look at the page src, so, it's working.
I got this tutorial from this link: http://code.google.com/apis/maps/articles/phpsqlajax.html#outputxml ** These links below on my server are (respectively): http://www.a-znewhomes.com/phpsqlajax_map.htm * & http://www.a-znewhomes.com/phpsqlajax_genxml.php ** * OUTPUT MAP-* <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Google Maps AJAX + mySQL/PHP Example</title> <script src=" http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAwF0S79iQvK88CapctSaF1RTtJv-hPrG3MDETEuwr7bkJQbMeqxTd8v7Rq-7htAc5-HCN3BWksHpL9g" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ var iconBlue = new GIcon(); iconBlue.image = ' http://labs.google.com/ridefinder/images/mm_20_blue.png'; iconBlue.shadow = ' http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconBlue.iconSize = new GSize(12, 20); iconBlue.shadowSize = new GSize(22, 20); iconBlue.iconAnchor = new GPoint(6, 20); iconBlue.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png '; iconRed.shadow = ' http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconRed.iconSize = new GSize(12, 20); iconRed.shadowSize = new GSize(22, 20); iconRed.iconAnchor = new GPoint(6, 20); iconRed.infoWindowAnchor = new GPoint(5, 1); var customIcons = []; customIcons["1/1"] = iconBlue; customIcons["2/2"] = iconRed; function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(29.533896, -98.469778),10); GDownloadUrl("http://a-znewhomes.com/phpsqlajax_genxml.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var commname = markers[i].getAttribute("commname"); var builder = markers[i].getAttribute("builder"); var sqft = markers[i].getAttribute("sqft"); var rooms = markers[i].getAttribute("rooms"); var price = markers[i].getAttribute("price"); var school = markers[i].getAttribute("school"); var zip = markers[i].getAttribute("zip"); var description = markers[i].getAttribute("description"); var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(point, commname, builder, sqft, rooms, price, school, zip, description); map.addOverlay(marker); } }); } } function createMarker(point, commname, builder, sqft, rooms, price, school, zip, description) { var marker = new GMarker(point, customIcons[rooms]); var html = "<b>" + commname + "</b> <br/>" + builder; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } //]]> </script> </head> <body onload="load()" onunload="GUnload()"> <div id="map" style="width: 800px; height: 800px"></div> </body> </html> ***Corresponding PhP/XML- *<?php require("db_enter_file.php"); // 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(of course, I used the right server ip, but for security in this email I replaced with general local host)", $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 = "SELECT * FROM markers WHERE 1"; $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)){ // ADD TO XML DOCUMENT NODE $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("commname",$row['commname']); $newnode->setAttribute("builder", $row['builder']); $newnode->setAttribute("lat", $row['lat']); $newnode->setAttribute("lng", $row['lng']); $newnode->setAttribute("sqft", $row['sqft']); $newnode->setAttribute("rooms", $row['rooms']); $newnode->setAttribute("price", $row['price']); $newnode->setAttribute("school", $row['school']); $newnode->setAttribute("zip", $row['zip']); $newnode->setAttribute("description", $row['description']); } echo $dom->saveXML(); ?> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
