<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                                  
                                  <?php 
								$i=1;
$sql = "SELECT b_photogallery.*
				  FROM b_photogallery
				  ORDER BY b_photogallery.id_photogallery DESC";
$result = mysql_query($sql,$conn) or die ("errore ".mysql_error());
								while($row = mysql_fetch_array($result)){
								?>
								<?php
								if ($i==1){ echo "<tr align=\"center\" valign=\"top\">";
								} 
?>
                    <td align="center">
<style type="text/css">
.
<?=$row['foto']?>{
background-image: url(images_photogallery/<?=$row['foto']?>);
background-repeat: no-repeat;
background-position: center;
width: 200px;
}
</style>
                    
<table width="10" height="10" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td class="<?=$row['foto']?>"><a href="images_photogallery/<?=$row['foto']?>" rel="lightbox[roadtrip]">
[img]images/pixel_trasparente.gif[/img]</a></td>
  </tr>
    <tr>
    <td align="center">
</td>
  </tr>
</table>
</td>
                        <?
							if ($i==4){
								echo "</tr><tr align=\"center\" valign=\"top\"><td height=\"6\"></td><td></td><td></td></tr>";
								$i=0;
							}
							 $i++;
						}?>
                                </table>