Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Getting MySQL Data into an Array.

by miyagawa (Chaplain)
on Jan 06, 2002 at 15:27 UTC ( [id://136673]=note: print w/replies, xml ) Need Help??


in reply to Getting MySQL Data into an Array.

Try this:

@companies = map { $_->[0] } @{$dbh->selectall_arrayref('SELECT compan +y FROM company_public')};

--
Tatsuhiko Miyagawa
miyagawa@cpan.org

Replies are listed 'Best First'.
Re: Re: Getting MySQL Data into an Array.
by Anonymous Monk on Jan 06, 2002 at 23:37 UTC
    Wow... that is very neat.
Re: Re: Getting MySQL Data into an Array.
by cdherold (Monk) on Jan 07, 2002 at 08:34 UTC
    thanks for opening my mind. that's a cool one.
      Yes, that is indeed cool, but don't let your boss catch you using that. DBI has a method that will return a column for you:
      my @companies = @{$dbh->selectcol_arrayref(' SELECT company FROM company_public ')};

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      F--F--F--F--F--F--F--F--
      (the triplet paradiddle)
      

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-18 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found