0

This is my first post here, o let me say hi :)

I have a problem with my google map. What I try to do is to get locations from mySQL database, and set a marker for every location on the map. Seems prety basic and easy. But I have a very limited web-developer knowledge, being a chemist ;) What my page does - it just loads one record, not two (there are only two rows in the database anyway). You can find the code here

I have checked the query with another script - sit gets both records, while loop also seems fine. But somehow i get just 1 marker on the map :( COuld you have a look please and check for the mistakes? I assume something is wrong with the marker generation in the loop...

Cheers, Michal

NoNaMe
  • 6,020
  • 30
  • 82
  • 110

1 Answers1

2

You only have one marker.

var marker_ = new google.maps.Marker({ position: myLatLng, map: map, title: tytul, zIndex: id });

Here is a good way to handle it: Google Maps JS API v3 - Simple Multiple Marker Example

Community
  • 1
  • 1
Stevie
  • 36
  • 3
  • But is not a new marker declared every time the loop iterates? var marker_ = new google.maps.Marker its inside the loop and a marker called marker_$id is declared, so its like: marker_1, marker_2 ? I am reading your link atm, I did it in a similar way before, but later I had problems with pulling the data from mySQL server :) Thank you for help, I keep fighting on :D – user1887617 Dec 08 '12 at 12:03