$n = 1; while ($row = mysql_fetch_array ($res)) { echo "<td>billede</td>"; if (($n % 2) == 0) { echo "</tr><tr>"; } }