Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Aiuto per query (subquery)

    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 >

  2. #2
    parte 2 --->

    //inizio query e stampa hotel_normale
    $query = "SELECT * FROM hotel WHERE regione_hotel = '$regione' AND tipologia_hotel = 'normale' 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
    {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[provincia_hotel])
    ";
    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\">$array[indirizzo_hotel]
    $array[citta_hotel] ($array[cap_hotel] - $array[provincia_hotel])
    tel. $array[telefono_hotel]
    ";

    if ($array[fax_hotel]<>""){
    echo "<font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">fax. $array[fax_hotel]</font>
    ";
    }

    if ($array[web_hotel]<>""){
    echo "<font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">web: <a href=\"http://$array[web_hotel]\" target=\"_blank\">$array[web_hotel]</a></font>
    ";
    }

    if ($array[mail_hotel]<>""){
    echo "<font face=\"Verdana,Aria,Helvetica\" size=\"1\" color=\"#394A80\">mail: <a href=\"mailto:$array[mail_hotel]\">$array[mail_hotel]</a></font>
    ";
    }

    echo "</td>";
    echo "</tr>";
    echo "</table>";
    echo "</td>";
    echo "<td width=\"160\" valign=\"top\"><img src=\"$array[url_foto1_hotel]\" width=\"160\" height=\"104\" border=\"0\" alt=\"\"></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_normale

    ?>

    [/CODE]

    Con questa query visualizzo correttamente gli prima gli hotel "top" inseriti nel db e poi gli hotel "normali", ordinati per ordine di stella (da 5 stelle lusso a una stella) e non in maniera alfabetica.

    Secondo voi come potrei modificare la query in modo che gli hotel siano visualizzati prima per ordinamento stelle e contemporaneamente in ordine alfabetico ?

    Per esempio:

    Hotel A (***** L)
    Hotel B (*****)
    Hotel C (**** S)

    e cosi' via...

    Il funzionamento di quella pagina e' gia' correttamente online (solo che sono visualizzati per ordine stelle e non per ordine alfabetico) a questo url

    Ciaooo e grazie

  3. #3
    Utente di HTML.it L'avatar di luca200
    Registrato dal
    Apr 2002
    Messaggi
    4,120
    $query = "SELECT * FROM hotel WHERE regione_hotel = '$regione' AND tipologia_hotel = 'top' ORDER by stelle_hotel DESC";
    SELECT * FROM hotel WHERE regione_hotel = '$regione' AND tipologia_hotel = 'top' ORDER by stelle_hotel DESC, nome_hotel ASC


    P.S. non ha senso duplicare i blocchi di codice relativi agli hotel 'normale' e 'top', visto che hai messo le condizioni nelle due query

  4. #4
    Perfetto direi, ora funziona !


    P.S. non ha senso duplicare i blocchi di codice relativi agli hotel 'normale' e 'top', visto che hai messo le condizioni nelle due query
    Si, effettivamente hai troppo ragione, mi metto subito a ripulire un po' il codice.....

    Ciaooo e grazie 1000!!!
    Micky

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.