The short answer is "yes".
...however, your sample code appears to misunderstand the execute method.
$sth = $dbh->prepare($statement); $sth->execute(<placeholder values here>); # retrieve results here $sth->finish; # if there is any risk of not having fetched all the val +ues
Note that if you prepare a statement that needs values filled in on the fly, you can usually replace them with a question mark (no quotes). When you execute the statement, you provide values for each placeholder to the execute statement. DBI takes care of quoting things that need quoted for you, as well as taking advantage of not having to re-parse the statement each time you want to execute it (if the DBD supports doing this).
The Cheetah book (Programming the Perl DBI) from O'Reilly, is probably worth looking into if you expect to be doing any significant amount of database programming (which almost certainly will involve using DBI).
In reply to Re: Multiple DB Queries using DBI
by herveus
in thread Multiple DB Queries using DBI
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |