Hallow!
I have a script who generate html table from MySql data. I want break table with variable
$record_per_row
. And script work ... But if I scan HTML code, I look this
<table>
<tr>
<td>data</td>
</tr>
....
...
....
<tr>
<td>data</td>
missing......:eek:
</table>
Missing "</tr>" tag only in the end of table!
Here is PHP script:
echo "<table width=100%>";
$max_record_num = "14";
$record_per_row = "3";
$select = "select `name` from `category` LIMIT $max_record_num";
$query1 = mysql_query ($select) or die (mysql_error());
$i = 0;
while ($row = mysql_fetch_array ($query1))
{
if ($i % $record_per_row == 0)
{
echo "<tr>";
}
echo "<td>$row['name']</td>";
++$i;
if ($i % $record_per_row == 0)
{
echo "</tr>";
}
}
echo "</table>";
Any help me?
Thanx!