Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: More DBI Problems!!!

by repson (Chaplain)
on Apr 23, 2001 at 14:47 UTC ( #74677=note: print w/ replies, xml ) Need Help??

in reply to More DBI Problems!!!

It would help if you told us which line 50 was in the future.

However, I think the problem is in

The method selectrow_array is for performing a full prepare, execute and returning the array. The parameter is an sql string, not a query object.

What you probably meant was:

Which returns a single row of the prepared and executed query it is call on.

Comment on Re: More DBI Problems!!!
Select or Download Code
Replies are listed 'Best First'.
Re: Re: More DBI Problems!!!
by chipmunk (Parson) on Apr 24, 2001 at 08:00 UTC
    I think repson must be right that you meant to use $query->fetchrow_array instead of $dbh->selectrow_array($query).

    However, the $dbh->select... methods can take an already prepared statement handle as the first argument. This allows you to prepare the statement once ahead of time, and then execute it with select... many times. For example:

    my $sth = $dbh->prepare(<<EndOfSQL); SELECT name FROM item WHERE id = ? EndOfSQL while (<>) { chomp; if (($name) = $dbh->selectrow_array($sth, {}, $_)) { print "$_ => $name\n"; } else { print "$_ not found\n"; } }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2015-11-28 22:02 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls