[beginners list snipped]

On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:

>Second step is to show every table contents (by clicking on link with table
>name).
>To do this I need to know how many columns is in table, and all names of columns
>in table.

You can do (very portable):

        my $sth = $dbh->prepare("SELECT * FROM $table");
        $sth->execute;
        my @fieldnames = @{$sth->{NAME}};
        $sth->finish;

Check the contents of @fieldnames.

Check the other "statement handle attributes" in the DBI docs, such as
"TYPE" and "NULLABLE" (instead of "NAME"), for more interesting
properties.

-- 
        Bart.

Reply via email to