[Solved] Show multiple markers on Google Maps Using PHP and MySQL

I tried to use PHP and MySQL to show multiple markers on Google Maps. The code below uses PHP to connect to the database so as to get the latitude and longitude.

The problem is the map doesn’t show, but once I delete this line, it works without getting the markers: "var liste_des_points=[<?php echo $listeDesPoints; ?>];". I think the problem is the PHP format.

Please help me with this .

     <%@ page language="java" contentType="text/html; charset=UTF-8"
     <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

     $connexion=mysql_connect("localhost", "root", "") or die(mysql_error());
     mysql_select_db("survey",$connexion) or die(mysql_error());

     $result = mysql_query("SELECT latitude, longitude FROM appreciation order by id");

     while($row = mysql_fetch_array($result)){
     if($listeDesPoints!='') $listeDesPoints.=','; 


          <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
          <style type="text/css">
           html { height: 100% }
           body { height: 100%; margin: 0; padding: 0 }
           #map_canvas { height: 100% }
           <script type="text/javascript"
        <script type="text/javascript">
         function initialize() {
            var optionsCarte = {
              center: new google.maps.LatLng(34.02,-6.83),
              zoom: 8,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            var map = new     google.maps.Map(document.getElementById("map_canvas"),

            var liste_des_points=[<?php echo $listeDesPoints; ?  >];

            var i=0,li=liste_des_points.length;
            new google.maps.Marker({
                   position: new google.maps.LatLng(liste_des_points[i][0], liste_des_points[i][1]),
                   map: map,

      <body onload="initialize()">
        <div id="map_canvas" style="width:100%; height:100%">    </div>
Enquirer: Asma.O


The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy