1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
   | <?php
include ("accesBD.php");
 
?>
<html>
 
  <head>
    <title>Application Google Maps : Échelle (scale)</title>
 
    <script src="http://maps.google.com/maps?file=api&v=2&key=
    ABQIAAAA5WAhzcHvs2msRCAxwACQeRQRS_aTR_o5dMi6DgHlcvJFGO9_kRS0MXAEjsyLOItmioIu8y103SoLUQ"
    type="text/javascript"></script>
 
 
 
	<?php  
        
        $result = mysql_query("select adresse  FROM deal ");
        $i=0;
        while( $donnees = mysql_fetch_array($result))
        {
          $table_adresse[$i]=$donnees['adresse'];
          
         $i++; 
         }
 
        mysql_close();
  
echo $table_adresse[1];
echo $table_adresse[0];
        
         $compteur_adresse=count($table_adresse);
    ?>    
 
    <script type="text/javascript">//<![CDATA[
 
 
      var map = null;
      var geocoder = null;
      function load()
        {
        if (GBrowserIsCompatible())
          {
 
          map = new GMap2(document.getElementById("carte"));
          map.setCenter(new GLatLng(49.8, 2.4), 15);
// Initialisation de l'objet "GClientGeocoder"
          geocoder = new GClientGeocoder();
// Initialisation de l'adresse
 
 
// Appel de la fonction d'affichage de l'adresse
      for ( var j = 0; j <= <?php echo $compteur_adresse;?> ; j++) {
          var adresse = '<?php echo $table_adresse['j'] ; ?>';
          showAddress(adresse);
		  }
		  // ajout de la propriété zoom à la carte "map"
		  map.addControl(new GSmallMapControl);
		  // ajout de la propriété d'affichage des boutons "type de carte" (3 boutons par défaut)
          map.addControl(new GMapTypeControl());
 
 
          }
        }
// Fonction de geocoding.
// Transformation d'une adresse en coordonnées
      function showAddress(addresse)
        {
        if (geocoder)
          {
          geocoder.getLatLng(addresse, function(point)
            {
            if (!point) {alert(addresse + " not found");} // Adresse non connue par Google Maps
            else
              {
              var marker = new GMarker(point); // Initialisation d'un marker
              map.addOverlay(marker); // Affichage du marker
              marker.openInfoWindowHtml(addresse); // Affichage d'une bulle contenant l'adresse
              }
            });
          }
        }
    //]]></script>
  </head>
 
  <body onload="load()" onunload="GUnload()">
    <div id="carte" style="width: 500px; height: 300px"></div>
  </body>
</html> | 
Partager