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
|
---|
In Section
Seekers of Perl Wisdom