Codice PHP:
$query="select * from immagini_hotel where id_hotel=\"$id_hotel\" and attiva=\"1\" order by id_foto desc"
$risultato = @mysql_query($query)  
or die(
"Impossibile eseguire l'interrogazione.");  
while (
$riga mysql_fetch_array($risultato)) { 
$foto_per_riga=6// numero di foto per riga
$i=1//contatore
$id_hotel $riga['id_hotel']; 
$id_foto $riga['id_foto']; 
$foto $riga['foto']; 
$titolo $riga['titolo']; 
$attiva $riga['attiva']; 
if(
$i%$foto_per_riga==0)
echo 
"<tr>";
echo 
"<td><a href=\"http://www.miosito.it/immagini_hotel/$cartella/grandi/$foto\" class=\"highslide\" onclick=\"return hs.expand(this)\"><img src=\"http://www.miosito.it/immagini_hotel/$cartella/$foto\" border=1 width=100 height=66></a><div class=\"highslide-caption\">$hotel - $comune $stellaimg</div></td>";
if(
$i%$foto_per_riga==0)
echo 
"</tr>";
$i++; // incremento il contatore