On Tue, May 21, 2002 at 10:34:04AM -0600, Ian Harisay wrote:
> Hi,
> Does anyone know how to generate column headers for output based on the SQL.
> my $sth = $dbh->prepare("SELECT field1, field2 FROM table1");
> $sth->execute;
> 
> print $headers ## how would I do this based on the fields returned??

Look in the DBI docs for the the NAME_uc and NAME_lc statement handle
attributes.  Alternatively, you could use one of the fetch or select
methods that returns a hash for each row rather than an array.

Ronald

Reply via email to