Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Field names from DBI?

by Lachesis (Friar)
on Jun 10, 2003 at 11:13 UTC ( [id://264629]=note: print w/replies, xml ) Need Help??


in reply to Field names from DBI?

To get the table field names you can do the following
my $sth = $dbh->prepare("SELECT * FROM $tablename WHERE 1=0"); $sth->execute(); my $fields = $sth->{NAME};
$dbh should be your connected DB handle
$fields will be an arrayref of the fieldnames
You can also look at the table_info method but check the docs for your DBD driver to see if its supported

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://264629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found