Da una query, vorrei visualizzare 6 foto per riga di una tabella, ma non ci riesco:

Codice PHP:
<table border="0" align="center" cellspacing="1" cellpadding="0">
<tr><th>Pictures</th></tr>
<?php
    $pictures 
= @mysql_query($select $from $where);
    if(!
$pictures) {    //il testo di ricerca è specificato
        
echo '</table>';
        exit(
'<p align="center">Error retrieving pictures from databases!
'
.
            
'Error: '.mysql_error().'</p>');

    }
//if
    
    
$count 0;
    while (
$picture mysql_fetch_array($pictures)) {
          echo 
"<tr valign='top'>";
          
$id $picture['id'];
          
$filename htmlspecialchars($picture['filename']);
          
$extension htmlspecialchars($picture['extension']);
          
$description htmlspecialchars($picture['description']);
          
$miniatura 'foto/'.$filename.'_s'.$extension;
          echo 
"<td>";
              print 
'[img]'.$miniatura.'[/img]';
          echo 
"</td>";
          if(
$count==6) {    //a capo ogni 6 foto        
            
echo "</tr>";
            
$count 0;

        }else{
            
$count $count+1;

        }
//else
      
}//while
      
?>
</table>