Ho risolto alla perfezione (intendo nel funzionamento, non certo nel codice di programmazione) con il seguente codice.
Se qualcuno volesse darmi un parere mi farebbe piacere.
Grazie.
Codice PHP:
echo "<Table Width=\"90%\" align=\"center\">";
$mysqli = new mysqli("$dbhost", "$dbuser", "$dbpass");
$mysqli->select_db("$dbname");
$result = mysqli_query ($mysqli,"SELECT * FROM fotografie_rally GROUP BY anno ORDER BY orientamento ASC,anno DESC LIMIT $limite OFFSET $offset");
$num = mysqli_num_rows ($result);
$end=1;
$i=1;
while($row = mysqli_fetch_assoc($result)) {
$file = $row['nome_file'];
$anno = $row['anno'];
$title = $row['anno'];
$subtitle = "ANNO $anno";
if ($anno == 2004) {
$title = "PRIMA DEL 2005";
$subtitle = "PRIMA DEL 2005"; }
list($width, $height) = getimagesize("fotografie_rally/miniature/$file");
if (($width) <= ($height)) {
$visualizza = "<Img Src=\"fotografie_rally/miniature/$file\" Height=\"110\" Border=\"1\" alt=\"$title\" title=\"$title\">"; }
if (($height) <= ($width)) {
$visualizza = "<Img Src=\"fotografie_rally/miniature/$file\" Width=\"110\" Border=\"1\" alt=\"$title\" title=\"$title\">"; }
if ($i==1) {
echo "<tr>"; }
echo "<Td>";
echo "<Table align=\"center\" Cellpadding=\"0\" Cellspacing=\"3\">";
echo "<Tr>";
echo "<Td>";
echo "<center><a href=\"dettaglio_foto_rally.php?anno=$anno\" class=\"border\">";
echo "$visualizza</a></center>";
echo "</Td>";
echo "</Tr>";
echo "<Tr>";
echo "<Td Valign=Top class=\"style_denominazione\">";
echo "<center><a href=\"dettaglio_foto_rally.php?anno=$anno\" class=\"border\">"; echo "<b>$subtitle</b></a></center>";
echo "</Td>";
echo "</Tr>";
echo "</Table>";
echo "</Td>";
if ($end == $num) break;
else {
if($i==4) { echo "</tr>"; $i=1; $end++; }
else { $i++; $end++; }}
}
echo "</Tr>";
echo "</Table>";