Perfect! It works now :-)
On 23/03/2009, at 22.24, Jeremy Geerdes wrote: > The last line of your php code is a problem. Specifically, > footer.php is throwing your xml off by adding a bunch of closing > tags that were never opened. > > Jeremy R. Geerdes > Effective website design & development > Des Moines, IA > > For more information or a project quote: > http://jgeerdes.home.mchsi.com > http://jgeerdes.blogspot.com > http://jgeerdes.wordpress.com > [email protected] > > Unless otherwise noted, any price quotes contained within this > communication are given in US dollars. > > If you're in the Des Moines, IA, area, check out Debra Heights > Wesleyan Church! > > And check out my blog, Adventures in Web Development, at > http://jgeerdes.blogspot.com > ! > > > On Mar 23, 2009, at 4:18 PM, webmaster wrote: > >> Hello again >> >> you have been very kind to answer my request again. In case you >> have some time to look at the issue, I am reporting the two files I >> have intended to reuse from the webpage you suggested to me >> >> http://code.google.com/support/bin/answer.py?answer=65622&topic=11369 >> >> >> Here they are >> >> 1) phpsqlajax_map.htm >> >> <!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=ABQIAAAA0swsyppeo4WAJSi_mEUUgBQvZHi5Z2qeqRnpT_zuEAl2yvinaRS4LuhfTCbt1N_bkeKL5EBk04oRsw >> >> " >> >> 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["restaurant"] = iconBlue; >> customIcons["bar"] = iconRed; >> >> function load() { >> if (GBrowserIsCompatible()) { >> var map = new GMap2(document.getElementById("map")); >> map.addControl(new GSmallMapControl()); >> map.addControl(new GMapTypeControl()); >> map.setCenter(new GLatLng(47.614495, -122.341861), 13); >> >> GDownloadUrl("phpsqlajax_genxml2.php", function(data) { >> var xml = GXml.parse(data); >> var markers = >> xml.documentElement.getElementsByTagName("marker"); >> for (var i = 0; i < markers.length; i++) { >> var name = markers[i].getAttribute("name"); >> var address = markers[i].getAttribute("address"); >> var type = markers[i].getAttribute("type"); >> var point = new >> GLatLng(parseFloat(markers[i].getAttribute("lat")), >> >> parseFloat(markers[i].getAttribute("lng"))); >> var marker = createMarker(point, name, address, type); >> map.addOverlay(marker); >> } >> }); >> } >> } >> >> function createMarker(point, name, address, type) { >> var marker = new GMarker(point, customIcons[type]); >> var html = "<b>" + name + "</b> <br/>" + address; >> GEvent.addListener(marker, 'click', function() { >> marker.openInfoWindowHtml(html); >> }); >> return marker; >> } >> //]]> >> </script> >> </head> >> >> <body onload="load()" onunload="GUnload()"> >> <div id="map" style="width: 500px; height: 300px"></div> >> </body> >> </html> >> >> >> >> >> >> 2) phpsqlajax_genxml2.php >> >> <? >> include("connessione.php"); >> ?> >> >> <? >> function parseToXML($htmlStr) >> { >> $xmlStr=str_replace('<','<',$htmlStr); >> $xmlStr=str_replace('>','>',$xmlStr); >> $xmlStr=str_replace('"','"',$xmlStr); >> $xmlStr=str_replace("'",''',$xmlStr); >> $xmlStr=str_replace("&",'&',$xmlStr); >> return $xmlStr; >> } >> >> >> >> // Select all the rows in the markers table >> $query = "SELECT * FROM maps_markers WHERE 1"; >> $result = mysql_query($query); >> if (!$result) { >> die('Invalid query: ' . mysql_error()); >> } >> >> //header("Content-type: text/xml"); >> >> // Start XML file, echo parent node >> echo '<markers>'; >> >> // 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 'type="' . $row['type'] . '" '; >> echo '/>'; >> } >> >> // End XML file >> echo '</markers>'; >> >> >> ?> >> <? include ("footer.php"); ?> >> >> You can see the result here: >> >> http://serate-italiane.dk/phpsqlajax_map.htm >> >> >> >> >> >> >> On 23/03/2009, at 22.03, Jeremy Geerdes wrote: >> >>> >>> Unfortunately, it's impossible to tell what the problem may be >>> judging >>> solely by the description you have provided. At the very least, I >>> will need to see a link to the script so I can see it's output; it >>> is >>> also quite possible that I'll need to see actual code. >>> >>> Jeremy R. Geerdes >>> Effective website design & development >>> Des Moines, IA >>> >>> For more information or a project quote: >>> http://jgeerdes.home.mchsi.com >>> http://jgeerdes.blogspot.com >>> http://jgeerdes.wordpress.com >>> [email protected] >>> >>> Unless otherwise noted, any price quotes contained within this >>> communication are given in US dollars. >>> >>> If you're in the Des Moines, IA, area, check out Debra Heights >>> Wesleyan Church! >>> >>> And check out my blog, Adventures in Web Development, at >>> http://jgeerdes.blogspot.com >>> ! >>> >>> >>> On Mar 23, 2009, at 4:00 PM, Gino Rocca wrote: >>> >>>> >>>> Hello jeremy, >>>> >>>> I had a look at the very informative tutorial below >>>> http://code.google.com/support/bin/answer.py?answer=65622&topic=11369#outputxml >>>> >>>> Howver I am blocked at the step "Checking that XML output works" >>>> >>>> I cannot output the xml file, even though data are present in my >>>> database and I do not seem to get errors. >>>> >>>> Any hints on how I could proceed or debug? >>>> >>>> Thanks for the help >>>> >>>> >>>> On Mar 23, 1:33 pm, Jeremy Geerdes <[email protected]> wrote: >>>>> Check out this page on the Google Maps Group: >>>>> >>>>> http://groups.google.com/group/Google-Maps-API/web/using- >>>>> databases- >>>>> wi... >>>>> >>>>> Jeremy R. Geerdes >>>>> Effective website design & development >>>>> Des Moines, IA >>>>> >>>>> For more information or a project quote:http://jgeerdes.home.mchsi.comhttp >>>>> ://jgeerdes.blogspot.comhttp://jgeerdes.wordpress.com >>>>> [email protected] >>>>> >>>>> Unless otherwise noted, any price quotes contained within this >>>>> communication are given in US dollars. >>>>> >>>>> If you're in the Des Moines, IA, area, check out Debra Heights >>>>> Wesleyan Church! >>>>> >>>>> And check out my blog, Adventures in Web Development, >>>>> athttp://jgeerdes.blogspot.com >>>>> ! >>>>> >>>>> On Mar 23, 2009, at 7:20 AM, Gino Rocca wrote: >>>>> >>>>> >>>>> >>>>>> For my no-profit community webpage >>>>> >>>>>> I would like to generate gocodes and visualize an overaly of >>>>>> markers >>>>>> on a google map, based on some data (adress: street, br, city >>>>>> name) on >>>>>> my database. >>>>> >>>>>> Any hints on how to do that? >>>>> >>>>>> example: >>>>> >>>>>> starting from following data whcih I can retrieve through php/ >>>>>> mysql >>>>>> interaction >>>>> >>>>>> copenhagen, Saxogade 5 >>>>>> Odense, Vestergade 3 >>>>> >>>>>> etc. >>>>> >>>>>> I would like to generate a googlemap with a 2 markers >>>>>> corrsponding >>>>>> to >>>>>> the two locations. >>>>> >>>>>> As second task, I would lilke to be able to click on the >>>>>> markers and >>>>>> open a window with more detailed information about the events in >>>>>> Copenhagen and Odense. >>>>> >>> >>> >>> >>> >> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" 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-AJAX-Search-API?hl=en -~----------~----~----~----~------~----~------~--~---
