I'm trying to get a table generated with information from the database
So far i have this code
if(mysql_num_rows($result)) {
echo '<table width="100%" border="0">'."\n<tr>\n";
while($row = mysql_fetch_array($result))
{
echo "\n".'<td><img src="'.$row['url'].'" alt="'.$row['desc'].'" border="0"/><br/>'.$row['name'].'</td>';
$i++;
if($i == 5)
{
echo "</tr>\n<tr>\n";
}
}
echo "\n</tr>\n</table>\n";
}
its displays correctly, but im trying to tidy it up
If i have 5/10/15 etc records from the database i end up with a blank
<tr></tr>
i'm wondering how to stop this. I don't want the echo "</tr>\n<tr>\n"; too happen if the last record is number 5/10 etc.