Answer the question
In order to leave comments, you need to log in
How to put labels in google map from db array?
Hello. I'm struggling with the problem of creating labels from an array. There is a DB in which coordinates of points contain. There is a web page with a google map. It is necessary to display the labels from the database into an array, as I understand it in php, and place them on the map already in javascript. There are no problems with php and database, with the map too (marks statically filled in javascript are placed). But I have no idea how to implement this in PHP + javascript. Prompt in what direction to dig.
Answer the question
In order to leave comments, you need to log in
You get data from the DB and insert it into the google maps API.
Why are you all too lazy to read the documentation for what you are going to work with.
https://developers.google.com/maps/documentation/j...
The easiest way is to have an array with coordinates
// Multiple Markers
var markers = [
['London Eye, London', 51.503454,-0.119562],
['Palace of Westminster, London', 51.499633,-0.124755]
];
for( i = 0; i < markers.length; i++ ) {
// ...
var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
marker = new google.maps.Marker({
position: position,
map: map,
title: markers[i][0]
});
// ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question