<disclaimer> I am not a php coder, nor will I ever be. It is however too useful to ignore in certain situations. As a result I know just enough php to hack some scripts/functions/etc together into something functional. Occasionally I run up against a situation where several hours of research has failed to provide an answer I can fathom. Hence this question. Not lazy, just stumped.</disclaimer>
Hacking some prewritten snippets in order to extract data from a db table and display inside an html table. Everything works fine except as written the script has no ability to insert new row (eg: <tr> </tr> every so many rows. Know there is a way to do this but beyond my meager talents. Table data is being inserted into is wide enough to carry 4 cells as defined by the data being inserted.
<?php
include $_SERVER['DOCUMENT_ROOT'] . "/lib/php/connect.php";
$query="SELECT * FROM gal_images";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
?>
<table border="1" cellspacing="2" cellpadding="2">
<tr>
<?php
$i=0;
while ($i < $num)
{
$ImageTitle=mysql_result($result,$i,"ImageTitle");
$ImageThumb=mysql_result($result,$i,"ImageThumb");
$ImageFull=mysql_result($result,$i,"ImageFull");
?>
<td align="center">
<a href=<?php echo $ImageFull; ?> target=blank><img src=<?php echo $ImageThumb; ?> ></a><br>
<b><?php echo $ImageTitle; ?></b>
</td>
<?php
$i++;
}
?>
</tr>
</table>
Basic question is, how do I insert </tr><tr> after every fourth line in the loop?
TIA for your comments and suggestions