I've been experimenting with this code for a few days while teaching myself to turn my site into a database driven site. I just leapt another hurdle, but noticed (because instead of using crap images for test purposes, I inserted a few 'real' images from my site) that this is skipping a loop.
The behavior is odd. If set at three, it skips the first image that would show up on the 2nd row. Ok, it's skipping.
img1 img2 img3
img5 img6
If set at two, it seems to count even images that it skips. Huh?
img1 img2
img4
img6
I'm a bit of a newbie, but I believe that break and continue don't work in if, else statements? I tried inserting them and it had no effect (course, if they are supposed to work, I easily could have done it wrong).
$count=0;
$table = mysql_query("SELECT * FROM $page");
echo(" <b>$page gallery</b><br><br>");
echo("<table border='0' cellspacing='1' cellpadding='1' width='300' align='center'><tr>");
while ( $r = mysql_fetch_array($table) ) :
if ($count==3){
echo ("</tr><tr><td span='4'><img src='images/spacer.gif' height='10'
width='1'></td></tr><tr>");
$count=1;
}else{
$id=$r["id"];
$pic=$r["pic"];
$thumb=$r["thumb"];
$pname=$r["pname"];
$pcom=$r["pcom"];
echo("<td align='center' valign='top' width='100'><a href='$pic' target='blank'><img src='$thumb'
border='0' align='left' alt='$pcom'></a><br clear='all'><a href='$pic' target='blank' alt='$pcom'
title='$pcom'><b>$pname</b></a></td>");
$count++;
}
endwhile;
echo ("</tr></table>");
😕