On Mon, 3 Jan 2005 16:06:42 -0600, [EMAIL PROTECTED]
>
> while (@row = $sth->fetchrow_array())
> {
> Tr( td( [EMAIL PROTECTED] ));
> }
>
> );
>
> $sth->finish();
There are a couple of things going on here...fetchrow_array returns a
normal array--unlike selectall_arrayref, which returns a reference--so
you need @row, not [EMAIL PROTECTED] The logic also gets a little more complex
than I usually have luck getting CGI.pm built-in functions to deal
with. For instance, you've put the closing paren on the table before
the while loop, so your Tr(td(..is hanging in space. print and
old-fashioned HTML are probably going to be your friends here.
I would do something like this:
<snippet>
print "HTML for your table headers" ;
while (@row = $sth->fetchrow_array) {
print "<tr>", map {"<td>$_ </td>"} @row, "</tr>\n"
# or:
# print "<tr>", map {defined $_ ? "<td>$_ </td>" :
"<td>(null)</td>"} @row, "</tr>\n" ;
}
print "</table>\n" ;
</snippet>
HTH,
--jay
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>