Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: $dbh->errstr;

by simeon2000 (Monk)
on Jul 24, 2002 at 13:40 UTC ( #184829=note: print w/replies, xml ) Need Help??


in reply to $dbh->errstr;

You have to put your the return of the prepare statement somewhere. Assuming use strict;:

my $sql = ''; if (cond) { $sql = $dbh->prepare(SQL_CODE); } elsif (cond2) { $sql = $dbh->prepare(SQL_CODE2); } else { $sql = $dbh->prepare(SQL_CODE3); } $sql->execute(@params);

Not only are you not storing the result of the prepare, even if you did, you must predeclare your $sql recipient variable or it'll go out of scope before you can execute it!

"Falling in love with map, one block at a time." - simeon2000

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2023-03-25 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?