Print array into 4 column HTML table
From: Adam (A_at_A.com)
Date: 06/25/04
- Next message: Perl.Org: "Win32::NetAdmin::LocalGroupGetMembers"
- Previous message: Larry Mullis: "RE: perl module installation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Jun 2004 16:22:45 -0500
I have an array "@row = $sth->fetchrow_array" that comes from a database
query:
$dbh = DBI->connect("DBI:mysql:$database:$db_server", $user, $password);
$statement = "SELECT city FROM trap WHERE $FORM{state}";
$sth = $dbh->prepare($statement) or die "Couldn't prepare the query:
$sth->errstr";
$rv = $sth->execute or die "Couldn't execute query: $dbh->errstr";
$rc = $sth->finish;
$rc = $dbh->disconnect;
So my @row array should have a list of cities that exist for a specific
state that can be virtually unlimited in length. I want to print these
cities in a HTML table that has four columns, here's the HTML for my row:
<TR>
<TD width="25%">
<DIV align=center><FONT
color=#2f2cff>Wheaton</FONT><BR></DIV></TD>
<TD width="25%">
<DIV align=center><FONT
color=#2f2cff>Chicago</FONT><BR></DIV></TD>
<TD width="25%">
<DIV align=center><FONT
color=#2f2cff>Gurnee</FONT><BR></DIV></TD>
<TD width="25%">
<DIV align=center><FONT
color=#2f2cff>Lisle</FONT><BR></FONT></DIV></TD>
</TR>
Obviously the city names in the HTML above should be automatically generated
from the array and not statically printed.
How can I make a PERL loop that prints my table automatically?
Thanks,
Adam
- Next message: Perl.Org: "Win32::NetAdmin::LocalGroupGetMembers"
- Previous message: Larry Mullis: "RE: perl module installation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|