Let's translate it to pseudocode:
CODE
counter=0
While (result = query to database) is true then
if counter not equal to 4 then
if P display location of P, else display location of M
counter=counter+1;
else
display separator for html table.
counter=0
end if
end while
what i see from this pseudocode is that the last of each five queries won't display, else the code for the 5th lap of the while loop will set the counter to 0.
For displaying the whole content of the database i'd do:
CODE
While (result = query to database) is true then
if P display location of P, else display location of M
if remainder(counter/4) is 3 display separators.
counter=counter+1;
end while
I'll program in another manner:
CODE
For counter=0 while (result=query to database) is true step 1 each time
if P display location of P, else display location of M
if remainder(counter/4) is 3 display separators.
end for
And this last one, translated to your script:
CODE
for($counter=0;$row = mysql_fetch_array($result));$counter++) {
if ($row["Type"] == P) echo "<td><a href='" . $row["Location"] . "'><img src='http://fjor.homeip.net" . $row['Location'] . "' width='175px' border='0'></a></td>";
else echo "<td><a href='dispMOV.php?file=" . $row["Location"] . "'><img src='media/movie.jpg' width='175px' border='0'></a></td>";
if($counter%4==3) echo "</tr><tr>";
}
Thank you so much for the help, I just couldnt see the problem, possibly because I've been coding all day