Hi there.I searched for a similar problem but couldn't find an answer.
I have a script that queries a database for multiple addresses and
plots the addresses on a google map no bother.
I do this inside a while loop.
The issue is that for each record I am reading, I plot the address
using map.addOverlay(marker); Then I try to add an overlay for each
marker, marker.openInfoWindowHtml(formattedOutput);

Unfortunately this doesn't work. Say if there are 3 records, it plots
the 3 addresses fine, but I only see one marker info and this contains
data from the first record pulled from the data base.

Here is my while loop (the data returned from the db query is solid):

while (resultIter.hasNext()) {
      var nextRecord = resultIter.next();
      var addressStr = nextRecord.streetName + ", " +
nextRecord.cityName + ", " + nextRecord.postCode + "," +
nextRecord.country;

      var point = geocoder.getLatLng(
      addressStr,
      function(par) { //call back function
      if (!par) {
      alert(address + " has not been found...");
      } else {
      map.setCenter(par, 12);
      var marker = new GMarker(par);
      map.addOverlay(marker);

      var formattedOutputStr = "<font>" + nextRecord.personName +
"<br />" + nextRecord.streetName + "<br />" + nextRecord.cityName + "
" + nextRecord.postCode + "<br />" + nextRecord.country + "</font>";
      alert(formattedOutput);

      marker.openInfoWindowHtml(formattedOutputStr);
} //close else
} //close function
);
} //close while

If I do an alert(formattedOutputStr); I see (for example) 3 points on
the map with 3 alert boxes that all contain the same
formattedOutputStr (i.e. info from the first retrieved MySQL record).
Unfortunately I can't post a screen shot...

Thanks for the the help

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

Reply via email to