Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Perl or SQL ?

by mpeppler (Vicar)
on Dec 22, 2005 at 08:38 UTC ( #518498=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl or SQL ?
in thread Perl or SQL ?

$sth->fetch returns an array reference, and $sth->fetchrow returns a list. Each item in the array or list is a column in the SELECT statement. So:

$sth = $dbh->prepare("select a, b, c from foo"); $sth->execute; while($row = $sth->fetch) { # $row->[0] is column 'a' # $row->[1] is column 'b', # etc... }
and
while(($one, $two, $three) = $sth->fetchrow_array) { # $one, $two and $three are columns a, b and c }
Michael

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2020-12-01 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (5 votes). Check out past polls.

    Notices?