Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: $dbh->errstr;

by simeon2000 (Monk)
on Jul 24, 2002 at 13:40 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found