In article <02011510194302.01235@gandalf>, Gerry Jones wrote:
> To recap: I don't need help with DBI or querying DB's, but with printing the 
> results into a table. I have two arrays: "@columns" (contains the column 
> names from the queried table), and "@data" (contains every row from that 
> table). I tried to adapt the code in Lincoln Stein's book, but all I got was 
> a table with the column headings and the first row was filled with the 
> "@data" array.

Here's how I would probably do it using 'pure' CGI.pm.
I assume that @data is an array of arrays, each sub-array being a row.

#!/usr/bin/perl -w
use strict;
use CGI qw(:html);

my @columns = qw( Foo    Bar     Baz   Quux   );
my @datas =([qw(  Eenie  Meenie               )],
                        [qw(  Barney Fred    Wilma        )],
                        [qw(  Just   Another Perl  Hacker )],
                );

print start_html('CGI Table'), table(
        { -border => 1 },
        Tr( [
                th(\@columns),
                map {td($_)} @datas,
        ])
), end_html();

__END__
 


-- 
briac
 << dynamic .sig on strike, we apologize for the inconvenience >>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to