Prova cosi:
dovrebbe funzionare.Codice PHP:
<?php
// tua query........ etc.....
echo "<table width=80% border=1 align=center><tr>";
while ($RIGO = mysql_fetch_array($query))
{
$i++;
if ($i == 5){
print ("</tr>");
print ("<tr>");
$i = 1;
}
// qui mostri le immagini
}
echo "</tr></table>";
?>