I was watching this correspondance earlier, and wondering why you are not using fetchrow_hashref. I now wonder why you get all the rows of data bundled into a single array. Does your interface have now way of returning data one row at a time?
A simple solution to your problem would go along the lines of my $rows =''; while (@data) # is the array empty yet? { my $row = "\n"; # just to layout the HTML for readability for (0..$#columns) { my $element = shift @data; $row .= td( $element ) } $rows .= Tr($row) } print table({-border=>'1', -align=>'CENTER', -valign=>'TOP'}, Tr({-align=>'CENTER', -valign=>'TOP'}, [ th(\@columns) ] ), $rows ) - Roger - ----- Original Message ----- From: "Gerry Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 15, 2002 4:11 PM Subject: Re: Tables in CGI > Thanks for your suggestions. I went back and tried some of them with no luck > I'm afraid. Here's my code as it is now: > > print table({-border=>'1', -align=>'CENTER', -valign=>'TOP'}, > Tr({-align=>'CENTER', -valign=>'TOP'}, > [ > th(\@columns), > td(\@data) > ] > ) > ) > > I tried using map as suggested by Briac Pilpré, but that gave the same output. > > Here's an example of what the arrays could contain from a PostgreSQL table > called "Components" (stored as "text" within the DB): > > @columns: > Subtype > Type > Components > > @data: > Celeron 766 > Computer > Lots of stuff > Pentium 2 > Computer > More Stuff > ... > ... > > I've checked the contents of each array (by printing them to the browser) and > they seem correct. > > Here I want a table 3 columns across and "x" rows down, but what I get is 3 > columns across, and @data scpread out across one row. Another table may > require 5 columns across. Problem is I don't know how to code the correct way > using CGI.pm. > > Thanks, > > Gerry. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]