add bookmarks google maps MYSQL

0

Do not add the markers on the map, the following code: I clarify that the db has all the data

<?php 
    $consultaB = "SELECT * FROM markers ";
    if ($bus = $enlace->query($consultaB)) {
        /* obtener el array de objetos */
        while ($filaB = $bus->fetch_row()) {
        echo "
            var marker = new google.maps.Marker({
                position: {lat: ".filaB[3].", lng: ".filaB[4]."},
                map: map,
                title: 'Mi ubicacion',
                animation: google.maps.Animation.DROP
            });";
        }
    }
?>
function initMap() {
    var map = new google.maps.Map(document.getElementById('map'), {
        center: {
                lat: -34.397,
                lng: 150.644
        },
        zoom: 15
    });
    var infoWindow = new google.maps.InfoWindow({
        map: map
    });
    // Try HTML5 geolocation.
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function(position) {
    var pos = {
        lat: position.coords.latitude,
        lng: position.coords.longitude
    };
    var myLatLng = {
        lat: -25.363,
        lng: 131.044
    };
    var marker = new google.maps.Marker({
        position: pos,
        map: map,
        title: 'Mi ubicacion',
        animation: google.maps.Animation.DROP
    });
<?php
    $consultaB = "SELECT * FROM markers";
    if ($bus = $enlace->query($consultaB)) {
    /* obtener el array de objetos */
    while ($filaB = $bus->fetch_row()) {
        echo "
            var marker = new google.maps.Marker({
                position: {lat: ".filaB[3].", lng: ".filaB[4]."},
                map: map,
                title: 'Mi ubicacion',
                animation: google.maps.Animation.DROP
            });";
        }
    }
?>
    map.setCenter(pos);
    },
    function() {
        handleLocationError(true, infoWindow, map.getCenter());
    });
    } else {
        // Browser doesn't support Geolocation
        handleLocationError(false, infoWindow, map.getCenter());
    }
}

function handleLocationError(browserHasGeolocation, infoWindow, pos) {
    infoWindow.setPosition(pos);
    infoWindow.setContent(browserHasGeolocation ?
        'Error: The Geolocation service failed.' :
        'Error: Your browser doesn\'t support geolocation.');
}
</script>
    
asked by Tomas Francisco Firbeda 27.04.2018 в 23:18
source

0 answers