0%3 = 0, because 0 = 03+0
1%3 = 1, because 1 = 03+1
2%3 = 2, because 2 = 03+2
3%3 = 0, because 3 = 13+0
4%3 = 1, because 4 = 13+1
5%3 = 2, because 5 = 13+2
6%3 = 0, because 6 = 23+0
7%3 = 1, because 7 = 23+1
------------------------
Instead of $count==($numrows%3) (which is only going to happen once if $numrows isn't changing - when $count is either 0, 1, or 2), you want
($count%3)==1 (I think it's 1 - the first image you show has $count==1, and you obviously want that to be on a new line, so yeah, you want a new line when $count%3==1.)
Y'know, I wonder why this while($row=mysql_fetch_assoc($result)) idiom is so popular - is it only because it's used in the manual? Is there something crushingly bad about using a for loop? Especially when you already know the number of rows?
for($count=1;$count<=$numrows; ++$count)
{
$row=mysql_fetch_assoc($result);
...
}