Ancora non sono riuscito a fare quello che voglio...
In pratica vorrei mostrare un hotel su una mappa e questo hotel deve avere come marker l'immagine fig/marker.png
nella stessa mappa voglio far mostrare anche gli altri hotel della zona e a questi hotel deve associarsi l'immagine fig/marker-blu.png
Vi allego anche un'immagina di quello che vorrei fare.
Questo e' il codice:
Faccio 2 query al database una per tirarmi fuori l'hotel e l'altra per vedere tutti gli hotel.
Come la modifico?
codice:
<?php
$hotel=$_GET['hotel'];
include("include/config.php");
$sql = "select hotel, comune, stelle, directory, indirizzo from hotel";
$sql2 = "select hotel, comune, stelle, directory, indirizzo from hotel where hotel='$hotel'";
$risultato = @mysql_query($sql)
or die("Impossibile eseguire l'interrogazione.");
while ($riga = mysql_fetch_array($risultato)) {
$hotel = $riga['hotel'];
$comune = $riga['comune'];
$stelle = $riga['stelle'];
$directory = $riga['directory'];
$indirizzo = $riga['indirizzo'];
$htmlhot=str_replace("HOTEL ","",$hotel);
$htmlhot=str_replace("RESIDENCE ","",$htmlhot);
$htmlhot=str_replace(" ","%20",$htmlhot);
$nomehtml=str_replace(" ","%20",$nome);
$mostra_posizione .="map.addOverlay(createMarker(new GLatLng($indirizzo), \"$hotel, $comune\"));\n";
}
$mostra_posizione_hotel .="map.addOverlay(createMarker(new GLatLng($indirizzo), \"$hotel, $comune\"));\n";
mysql_free_result($risultato);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mappa</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style media="screen" type="text/css">@import url('/s/site.css');</style>
<link rel="icon" type="image/gif" href="/favicon.gif" />
<style type="text/css">
#map {
margin: 0em 0;
border: 1px double #000;
width: 50em;
height: 35em;
}
</style>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAvd2-iXG4Tehop_UwetfTFxTv0LK4BckzWdlHpgRl5Rn0NJm61RQ_B6w1Kj0CqgFMZbJpBlTZojrNKQ" type="text/javascript"></script>
<script type="text/javascript">
function showMap()
{
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(40.727356,13.909893), 13);
var icon = [];
icon["topix"] = new GIcon(G_DEFAULT_ICON, "fig/marker.png");
function createMarker(point, description) {
var marker = new GMarker(point,icon["topix"]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(description);
});
return marker;
}
<?php echo "$mostra_posizione"; ?>
}
}
</script>
</head>
<body onload="showMap();" onunload="GUnload()">
<div id="main">
<div id="header">
</div>
<div id="content">
<div id="map">Il tuo browser non supporta le mappe di google o hai i javascript disattivati</div>
</div> </div> <div id="footer-wrapper"></div>
</body>
</html>
ecco l'immagine di quello che vorrei fare: