Ciao a tutti, utilizzo questo codice per stampare i record dal mio db e posizionare in contemporanea dei markers in google maps.
Il problema è che non stampa alcun record. O meglio, con questo codice non stampa nulla, ma se estrapolo il solo codice php e lo inserisco in una nuova pagina vuota con un semplice "echo $nome;" stampa tutto -.-"..Aiutatemi per piacere
codice:<script type="text/javascript"> //<![CDATA[ // this variable will collect the html which will eventually be placed in the side_bar var side_bar_html = ""; // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there var gmarkers = []; var map = null; var dettagli="<a href='index.php'>vai</a>"; function initialize() { // create the map var myOptions = { zoom: 13, center: new google.maps.LatLng(40.635711,17.942255), mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: false, panControl: false, scaleControl: false, mapTypeId: google.maps.MapTypeId.SATELLITE } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addListener(map, 'click', function() { infowindow.close(); }); // Add markers to the map // Set up three markers with info windows // add the points <?php include("vita/core.php"); $url=$_GET['spec']; $seq= $_GET['q']; $seo= $_GET['s']; $das= $_GET['o']; if(@$_GET['categoria']=='Tutti'){$rileva=mysql_query("select * from immobili1") or die(mysql_error());} if(@$_GET['categoria']=='Tutti' && @$_GET['s'] || @$_GET['o']){$rileva=mysql_query("select * from immobili1 order by ".$seo." ".$das." ") or die(mysql_error());} if(@$_GET['categoria']=='Tutti' && @$_GET['spec']){$rileva=mysql_query("select * from immobili1 where localita='".$_GET['spec']."'") or die(mysql_error());} if(@$_GET['categoria']=='Ricerca' && @$_GET['spec']=='Brindisi'){ if(!empty($_GET['q'])){$rileva=mysql_query("select * from immobili1 where zona='$seq' and localita='Brindisi' order by ".$seo." ".$das."") or die(mysql_error());} else {$rileva=mysql_query("select * from immobili1 where localita='Brindisi' order by ".$seo." ".$das."") or die(mysql_error());}} if(@$_GET['categoria']=='Ricerca' && @$_GET['spec']!='Brindisi'){$rileva=mysql_query("select * from immobili1 where localita='Brindisi' order by ".$seo." ".$das."") or die(mysql_error());} if(mysql_num_rows($rileva)>0){ while($arrayr=mysql_fetch_array($rileva)){ $nome=$arrayr['localita']; $info=$arrayr['descrizione']; $coordinate=$arrayr['coordinate']; $identify=$arrayr['riferimento']; $image=$arrayr['image']; $quartiere=$arrayr['zona']; echo'var point = new google.maps.LatLng('.$coordinate.'); var marker = createMarker(point,"<table><tr><td><div id=spostato><img src=img/'.$image.' style=width:150px; height:150px; class=thu></td><td><div id=stampato>'.$nome.' - '.$info.'</div></div></td></tr></table>","<div class=testoprimario>'.$nome.' - '.$quartiere.'<br><br><table><tr><td><img src=img/'.$image.' style=width:150px; ></td><td> '.$info.'</div></td></tr></table><br><br><img src=img/guarda.gif> <a class=via href=index.php?pagina=Scheda&identify='.$identify.'>Visualizza la galleria</a><br><br><img src=img/guarda.gif> <a class=via href=index.php?pagina=Scheda&identify='.$identify.'>Visualizza la scheda completa</a>");'; } } ?> // put the assembled side_bar_html contents into the side_bar div document.getElementById("side_bar").innerHTML = side_bar_html; } var infowindow = new google.maps.InfoWindow( { maxWidth: 300, maxHeight: 300 }); // This function picks up the click and opens the corresponding info window function myclick(i) { google.maps.event.trigger(gmarkers[i], "click"); } // A function to create the marker and set up the event window function function createMarker(latlng, name, html) { var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, zIndex: Math.round(latlng.lat()*-100000)<<5 }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map,marker); }); // save the info we need to use later for the side_bar gmarkers.push(marker); // add a line to the side_bar html side_bar_html += ' <a style=color:#121273; href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>'; } // This Javascript is based on code provided by the // Community Church Javascript Team // http://www.bisphamchurch.org.uk/ // http://econym.org.uk/gmap/ // from the v2 tutorial page at: // http://econym.org.uk/gmap/basic2.htm //]]> </script><img src='img/surprise.jpg' class='bg'> <div id='pag'>Lista immobili <img src='img/fr.png' width='30px' id='fr'> <?php if(empty($_GET['spec'])){echo"Tutti gli immobili";}else{ echo $_GET['spec'];;}?> </div> <br> <div id='pag_1'><br> <?php $sel=mysql_query("select * from immobili1 where localita='Ceglie'") or die(mysql_error()); $sel1=mysql_query("select * from immobili1 where localita='Fasano'") or die(mysql_error()); ?><table><tr><td> <form method='post' id='seleziona' action='contenuti/indicizzazione/redirect.php'>Seleziona la città: <select class='selectimmobili' size='1' name='set[]' onchange='submit()'> <option value='' nome='categoria'>Seleziona</option> <option value='Brindisi' nome='categoria'>Brindisi</option> <option value='Bari' nome='categoria'>Bari</option> <option value='Ceglie' nome='categoria'>Ceglie</option> <option value='Fasano' nome='categoria'>Fasano</option> <?php if(mysql_num_rows($sel)>0){echo"<option value='Ceglie' nome='categoria'>Ceglie</option>";} else {echo"<option value='Ceglie' nome='categoria' disabled='disabled'>Ceglie / Nessun immobile</option>";} ?> <?php if(mysql_num_rows($sel1)>0){echo"<option value='Fasano' nome='categoria'>Fasano</option>";} else {echo"<option value='Fasano' nome='categoria' disabled='disabled'>Fasano / Nessun immobile</option>";} ?> </select></form></td><td> <form method='post' id='seleziona' action='redirect.php?spec=<?=$_GET['spec']?>'> Ordina per: <select class='selectimmobili' size='1' name='seo[]'> <option value='' nome='categoria'>Seleziona</option> <option value='prezzo' nome='categoria'>prezzo</option> <option value='mq' nome='categoria'>mq</option> </select></td></tr></table><table style='position:relative; left:475px; top:-36px;'> <?php if(@$_GET['spec']=='Brindisi'){echo "<td> Seleziona il quartiere: <select class='selectimmobili' size='1' name='seq[]'> <option value='' nome='categoria'>Seleziona</option> <option value='casale' nome='categoria'>Casale</option> <option value='bozzano' nome='categoria'>Bozzano</option> <option value='centro' nome='categoria'>Centro</option> <option value='rosa' nome='categoria'>La Rosa</option></select></td>";} ?> <td> Da: <select class='selectimmobili' size='1' name='das[]'> <option value='' nome='categoria'>Seleziona</option> <option value='ASC' nome='categoria'>Crescente</option> <option value='DESC' nome='categoria'>Decrescente</option> </select><input type='submit' value='invia'></form></td></tr></table> </div> <div id='openyourmind_1'> <!-- you can use tables or divs for the overall layout --> <table style='position:relative; left:50%; margin-left:-650px;'><tr><td valign="top" style="width:600px;" frame="below"> <div id="side_bar" style='background:white;'></div> </td> <td valign="top" style="width:700px; text-decoration: underline; color: #4444ff;"> <a name='mappa'> <div id="map_canvas" style="width: 700px; float:right; height: 500px; "></div> </td> </tr> </table> </div><br><div id='spacedue'></div> <div id='quart'><center><a href='' class='quart'>Scarica l'app per mobile</a> <a href='' class='quart'>Seguici su Facebook</a> <a href='' class='quart'>Seguici su Twitter</a> <a href='' class='quart'>Contattaci via email</a> <a href='' class='quart'>Sito ottimizzato per Chrome</a></center></div> <div id='spacetre'></div>


Rispondi quotando