I want to output the contents of a DB table into an HTML table.
The DB table has 600 rows.
I'de like to have the output be formatted as an HTML table with 3 columns of
200 rows each.
<tr> <td>$indexs0-200</td> <td>$indexs201-400</td> <td>$indexs401-600</td> </tr>
I've gotten as far as outputting one long column, but this is
as far as I got.
I'm thinking I need to do a while loop with a for statement in it but I'm not
really sure how to do it.
Heres my code so far: Thanks - Donzo
#!/usr/bin/perl -w use DBI; use strict; use CGI; my $q; $q = new CGI; print $q->header, $q->start_html("District List"); my $dbh = DBI->connect("DBI:ODBC:PM_Pages","","") or die "Cannot conne +ct: " . $DBI::errstr; my $sql = "select District,DIST from Districts"; my $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr +(); $sth->execute() or die "Cannot execute: " . $sth->errstr(); my $district; my $ID; while (($district,$ID) = $sth->fetchrow_array) { print ("a href=\"$ID\">$district</a> <br> "); } $sth->finish(); $dbh->disconnect; print $q->end_html;
In reply to DBI output in 3 columns by Donzo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |