Ciao, avrei bisogno di un aiutino per una query che mi sta facendo diventare matto.
Ecco il problema e la query che funziona correttamente:
[CODE]
<?php
$regione = $_GET['regione'];
//inizio query e stampa hotel_top
$query = "SELECT * FROM hotel WHERE regione_hotel = '$regione' AND tipologia_hotel = 'top' ORDER by stelle_hotel DESC";
$result = mysql_query($query,$conn);
if (mysql_num_rows($result)==0){
}
else {
while ($array = mysql_fetch_assoc($result))
{
if ($array['tipologia_hotel']=='Normale') {
echo "<table bgcolor=\"#EFEFEF\" width=\"90%\" border=\"0\" cellspacing=\"4\" cellpadding=\"4\">";
echo "<tr>";
echo "<td valign=\"top\">";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td width=\"20\"><img src=\"images/spacer.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\">";
echo "</td>";
echo "<td><font face=\"Verdana,Aria,Helvetica\" size=\"2\" color=\"#394A80\">$array[nome_hotel]</font></td>";
echo "</tr>";
echo "<tr><td width=\"20\"><img src=\"images/spacer.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\">";
echo "</td>";
echo "<td>";
if ($array[stelle_hotel]=='1')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='2')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='3')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='3 S')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/s.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='4')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='5')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='4 S')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/s.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='5 L')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/l.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
echo "</td>";
echo "<tr>";
echo "<td width=\"33\"><img src=\"images/spacer.gif\" width=\"20\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "<td><font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">$array[citta_hotel] ($array[provincia_hotel])</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td width=\"160\" valign=\"center\"><img src=\"images/spacer.gif\" width=\"160\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "</tr>";
echo "</table>";
echo "<img src=\"images/spacer.gif\" width=\"1\" height=\"3\" border=\"0\" alt=\"\">";
}
else
{
echo "<table bgcolor=\"#E3EFF3\" width=\"90%\" border=\"0\" cellspacing=\"4\" cellpadding=\"4\">";
echo "<tr>";
echo "<td valign=\"top\">";
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td width=\"20\"><img src=\"images/bollino.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\">";
echo "</td>";
echo "<td><font face=\"Verdana,Aria,Helvetica\" size=\"2\" color=\"#394A80\"><a href=\"scheda.php?id=$array[id_hotel]\">$array[nome_hotel]</a></font></td>";
echo "</tr>";
echo "<tr><td width=\"20\"><img src=\"images/spacer.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\">";
echo "</td>";
echo "<td>";
if ($array[stelle_hotel]=='1')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='2')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='3')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='3 S')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/s.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='4')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='5')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='4 S')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/s.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
if ($array[stelle_hotel]=='5 L')
{echo "<img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"><img src=\"images/stellina.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\"> <img src=\"images/l.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"\">";
}
echo "</td>";
echo "<tr>";
echo "<td width=\"33\"><img src=\"images/spacer.gif\" width=\"20\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "<td><font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">";
if ($array[indirizzo_hotel]<>""){
echo "<font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">$array[indirizzo_hotel]
";
}
echo "$array[citta_hotel] ($array[cap_hotel] - $array[provincia_hotel])
";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "<td width=\"160\" valign=\"top\"><a href=\"scheda.php?id=$array[id_hotel]\"><img src=\"$array[url_foto1_hotel]\" width=\"160\" height=\"104\" border=\"0\" alt=\"\"></a></td>";
echo "</tr>";
echo "</table>";
echo "<img src=\"images/spacer.gif\" width=\"1\" height=\"3\" border=\"0\" alt=\"\">";
}
}
} //fine else per nessun hotel in regione
//fine query e stampa hotel_top
---- parte 2 >