My problem is the output, it goes fine until the 13th row then it messes up.
This is the code:
if (($thismanycats >12)&&($thismanycats <=18)) {
print qq~
<table width="100%"> ~;
$numm = 0;
$lo = $dbh->prepare("select name,tag from categories where active='yes' order by name ASC");
$lo->execute();
while ($qw = $lo->fetchrow_hashref()) {$cNAME = $qw->{'name'};
$cTAG = $qw->{'tag'};
$numm++;if ($numm =~ m/(2¦5¦8¦11¦14¦17)/) {$TRR = "";}
else {$TRR = "<tr>";}if ($numm =~ m/(3¦6¦9¦12¦15¦18)/) {$END = "</td></tr>"; $BEGIN = "<td valign=\"top\">";}
else {$END = "</td>"; $BEGIN = "$TRR<td valign=\"top\" width=\"33%\">";}print qq~
$BEGIN
($numm) <a href="http://example.com/packages/$cTAG/">$cNAME</a>
$END ~;
}
&closedb;if ($thismanycats =~ m/(3¦6¦9¦12¦15¦18)/) {$ENDTABLE = "</table>";}
else {$ENDTABLE = "</tr></table>";}print "$ENDTABLE";
}
<table width="100%">
<tr>
<td valign="top" width="33%"> (1) <a href="http://example.com/packages/coffee/">Coffee</a> </td>
<td valign="top" width="33%"> (2) <a href="http://example.com/packages/finance/">Finance</a> </td>
<td valign="top"> (3) <a href="http://example.com/packages/fish/">Fishing</a> </td>
</tr>
<tr>
<td valign="top" width="33%"> (4) <a href="http://example.com/packages/jsjshfdk/">Frosthe</a> </td>
<td valign="top" width="33%"> (5) <a href="http://example.com/packages/grime/">Grime</a> </td>
<td valign="top"> (6) <a href="http://example.com/packages/health/">Health</a> </td>
</tr>
<tr>
<td valign="top" width="33%"> (7) <a href="http://example.com/packages/hobbies/">Hobbies</a> </td>
<td valign="top" width="33%"> (8) <a href="http://example.com/packages/self-improvement/">Self Improvement</a> </td>
<td valign="top"> (9) <a href="http://example.com/packages/society/">Society</a> </td>
</tr>
<tr>
<td valign="top" width="33%"> (10) <a href="http://example.com/packages/sports/">Sports</a> </td>
<td valign="top" width="33%"> (11) <a href="http://example.com/packages/testing1/">Testing 1</a> </td>
<td valign="top"> (12) <a href="http://example.com/packages/test45/">Testing 45</a> </td>
</tr>
<td valign="top"> (13) <a href="http://example.com/packages/travel/">Travel</a> </td>
</tr>
<td valign="top" width="33%"> (14) <a href="http://example.com/packages/webmaster/">Webmaster</a> </td>
</tr>
</table>
I can't for the life of me figure out why the extra </tr> shows up after the 13th row, but I've been staring at this screen for almost 8 hours straight today: it's probably right in front of me.
If anyone has any suggestions please let me know.
Thanks.