hi guys!, I want to create a code that will dynamically fetch a rows of data in sql and display it on a 3 x 3 html table. i already found a code, the problem is every time the counter reach its limit it always print an opening and closing tags <tr></tr>. Is there a way to get rid of those tags? thanks guys. Here is an example code:
[CODE]<table><?php
$resultpackage = mysql_query(“SELECT * FROM package”,$db);
echo ‘<tr>’;
while ($package = mysql_fetch_array($resultpackage)) {
$counter2++;
echo ‘<td valign=”top”><h1>’.$package[‘name’].'</h1></p>. nl2br($package[‘description’]).'</p><p>’. nl2br($package[‘inclusion’]).'</p></td>’;
if ($counter2%2==0) {
echo ‘</tr><tr>’;
}}
echo ‘</tr>’;
?></table>
and it’s html output is this:
[CODE]
<table>
<tr>
<td>
<h1>Package Name</h1>
<p>Information</p>
<p>inclusion</p>
</td>
<td>
<h1>Package Name</h1>
<p>Information</p>
<p>inclusion</p>
</td>
</tr>
<tr>
<td>
<h1>Package Name</h1>
<p>Information</p>
<p>inclusion</p>
</td>
</tr><tr></tr></table>