Código PHP:
<?
include("inc/config.php");
// Query
$result = mysql_query("SELECT * FROM fotos WHERE categoria = 'Cocina' order by id desc");
$brk = false; // iniciamos una variable booleana
$carpeta="fotos/";
// abrimos tabla
echo "<table> <tr>";
while( $row = mysql_fetch_array($result) ) // bucle
{
echo "<td> <img src=\"$carpeta".$row['foto']."\" align='left' width='100' height='80' alt='$row[titulo]' border='0'> </td>";
if( $brk == true ) // Si la variable es true crea una nueva fila echo "</tr><tr>";
$brk = !$brk; // cambiamos la variable booleana a su valor opuesto
}
echo "</tr><table>"; // cerramos
?>