Visualizzazione dei risultati da 1 a 6 su 6

Visualizzazione discussione

  1. #4
    questo è il codice diciamo funzionante
    <?php$conn = mysql_connect("localhost", "xxxx", "xxxx") or die(mysql_error());
    mysql_select_db("mattina") or die(mysql_error());


    ?>
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title> Mappa</title>
    <style type="text/css">
    body { font: normal 15pt Helvetica, Arial; }
    #map { width: 850px; height: 700px; border: 5px; padding: 5px; }
    </style>
    <script src="http://maps.google.com/maps/api/js?key=_____________&sensor=false" type="text/javascript"></script>
    <script type="text/javascript">
    var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/yellow.png",
    new google.maps.Size(32, 32), new google.maps.Point(0, 0),
    new google.maps.Point(16, 32));
    var center = null;
    var map = null;
    var currentPopup;
    var bounds = new google.maps.LatLngBounds();
    function addMarker(lat, lng, info) {
    var pt = new google.maps.LatLng(lat, lng);
    bounds.extend(pt);
    var marker = new google.maps.Marker({
    position: pt,
    icon: icon,
    map: map
    });
    var popup = new google.maps.InfoWindow({
    content: info,
    maxWidth: 300
    });


    google.maps.event.addListener(marker, "click", function() {
    if (currentPopup != null) {
    currentPopup.close();
    currentPopup = null;
    }
    popup.open(map, marker);
    currentPopup = popup;
    });
    google.maps.event.addListener(popup, "closeclick", function() {
    map.panTo(center);
    currentPopup = null;
    });
    }
    function initMap() {
    map = new google.maps.Map(document.getElementById("map"), {
    center: new google.maps.LatLng(0, 0),
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: true,
    mapTypeControlOptions: {
    style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
    },
    navigationControl: true,
    navigationControlOptions: {
    style: google.maps.NavigationControlStyle.ZOOM_PAN
    }
    });


    <?php
    $query = mysql_query("SELECT cognome, nome, geo, lat, lng FROM moto")or die(mysql_error());
    while($row = mysql_fetch_array($query))
    {
    $cognome= $row['cognome'];
    $nome= $row['nome'];
    $lat = $row['lat'];
    $lng = $row['lng'];
    $desc = $row['geo'];
    echo("addMarker($lat, $lng, '$cognome.$nome');\n");

    }

    ?>
    center = bounds.getCenter();
    map.fitBounds(bounds);


    }
    </script>
    </head>
    <body onload="initMap()" style="margin:5px; border:5px; padding:5px;"></body>
    </html>
    questo è quello non funzionante
    <?php
    $conn = mysql_connect("localhost", "xxxx", "xxxx") or die(mysql_error());
    mysql_select_db("mattinale") or die(mysql_error());


    ?>
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title> Mappa</title>
    <style type="text/css">
    body { font: normal 15pt Helvetica, Arial; }
    #map { width: 850px; height: 700px; border: 5px; padding: 5px; }
    </style>
    <script src="http://maps.google.com/maps/api/js?key=________________&sensor=false" type="text/javascript"></script>
    <script type="text/javascript">
    var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/yellow.png",
    new google.maps.Size(32, 32), new google.maps.Point(0, 0),
    new google.maps.Point(16, 32));
    var center = null;
    var map = null;
    var currentPopup;
    var bounds = new google.maps.LatLngBounds();
    function addMarker(lat, lng, info) {
    var pt = new google.maps.LatLng(lat, lng);
    bounds.extend(pt);
    var marker = new google.maps.Marker({
    position: pt,
    icon: icon,
    map: map
    });
    var popup = new google.maps.InfoWindow({
    content: info,
    maxWidth: 300
    });


    google.maps.event.addListener(marker, "click", function() {
    if (currentPopup != null) {
    currentPopup.close();
    currentPopup = null;
    }
    popup.open(map, marker);
    currentPopup = popup;
    });
    google.maps.event.addListener(popup, "closeclick", function() {
    map.panTo(center);
    currentPopup = null;
    });
    }
    function initMap() {
    map = new google.maps.Map(document.getElementById("map"), {
    center: new google.maps.LatLng(0, 0),
    zoom: 14,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: true,
    mapTypeControlOptions: {
    style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
    },
    navigationControl: true,
    navigationControlOptions: {
    style: google.maps.NavigationControlStyle.ZOOM_PAN
    }
    });


    <?php
    $query = mysql_query("SELECT * FROM veicoli")or die(mysql_error());
    while($row = mysql_fetch_array($query))
    {
    $cognome= $row['cognome'];
    $nome= $row['nome'];
    $lat = $row['lat'];
    $lng = $row['lng'];
    $desc = $row['luogo_furto'];
    echo("addMarker($lat, $lng, '$cognome.$nome');\n");
    }

    ?>
    center = bounds.getCenter();
    map.fitBounds(bounds);


    }
    </script>
    </head>
    <body onload="initMap()" style="margin:5px; border:5px; padding:5px;"></body>
    </html>

    I dati vengono comunque cercati solo in lat e lng.

    schermata6.jpg schermata7.jpg
    Ultima modifica di benexxx; 15-07-2015 a 15:26
    http://www.angelogalantino.com

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.