I'm trying to add points to a Leaflet map.
The points are stored in a MySQL database as latitude and longitude.
I would like some leads and recommendations.
<?php
$showpoint = $bdd->prepare("SELECT t.Depart AS tDepart, v1.ville_latitude_deg AS lat1, v1.ville_longitude_deg AS long1,t.Arriver AS tArriver, v2.ville_latitude_deg AS lat2, v2.ville_longitude_deg AS long2 FROM trajet t, villes_france_free v1, villes_france_free v2 WHERE t.Depart = v1.ville_nom_reel AND t.Arriver = v2.ville_nom_reel");
$showpoint->execute();
$nbRows = $showpoint->rowCount();
?>
<script>
//Définir les coordonnées du centre de la carte et le seuil de zoom
var mymap = L.map('mapid').setView([43.665,7.193], 6);
// Ajouter le fond de carte
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(mymap);
<?php
$donnees = $showpoint->fetch();
for ($i = 0;$i< $nbRows; $i++)
{
L.marker($lat1[$i], $long1[$i]).addTo(mymap) .bindPopup("<b>Popup n°0</b>");
}
?>
</script>
So I would post all starting points and points to arrive.