Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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.

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]
[jdporter]: I for one think it's kind of ridiculous that people can't ask - here - other people for help just because it involves monetary compensation.
[jdporter]: I think the test for whether to push it to should be strict: (a) you're looking for employment, or (b) you're looking to hire an employee or contractor.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2017-03-23 01:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (278 votes). Check out past polls.