$i = 0; while ($a = mysql_fetch_array($cat)) { if ($i % 3 == 0) echo "\r\n"; echo "\t" . $a[navn] . "\r\n"; $i++; if ($i % 3 == 0) echo "\r\n"; }