Hello,
I am creating a photogallery and want to limit the number if pics per row. For example, I want to have 5 pics per row for however many rows there are (of course the last row might have less). I can't seem to get it right. Don't even know if I'm on the right track. I can do it in Cold Fusion but PHP seems to be throwing me for a loop. Any suggestions, comments, etc. would be greatly appreciated.
Thanks,
Joshua Ingram
Here's my code:
<Table align="center" width=25% border=0>
<?
$oddImage = 1;
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$counter = $counter + 1;
$size = GetImageSize("images/JoshTest/ $row[4]");
echo "<TR>";
echo "<TD width=50% COLSPAN=2 align='center'>";
if($Morph != "")
{
echo "<A HREF='Http://www.cornsnakes.net/photogallery_showpic.php?pgID=$row[0]&uType=Update' style='border-style: none;'>";
echo "<img width='$nwidth' height='$nheight' src='Http://www.cornsnakes.net/images/JoshTest/$row[4]' border='0' alt='$picName'>";
echo "</A>";
echo "</TD>";
if ($OddImg == 0)
{
echo "</tr>";
if($counter != $recordcount)
{
echo "<TR>";
}
$OddImage = 1;
}else{
if($counter == $recordcount)
{
echo "</TR>";
}
$OddImg = 0;
}
}
}
?>
</TABLE>