multiple prepared statements using PDO in php
I have a lot of php code that runs against a MySQL MyISAM database using the old (deprecated) mysql driver. I am trying to get the applications to run under Resin/quercus (4.0.37) with the desire to use multiple prepared statements against a single database connection. However, we keep running into the following error.
C:\resin-4.0.37\webapps\ROOT\testPdoStatements.php:21: Fatal Error: Uncaught exception of type 'PDOException' with message 'SQLSTATE[S1000]: No operations allowed after statement closed'
The code is fairly simple. I get a connection, prepare 2 statements but when I execute the first, the error is thrown. If I only prepare the one statement and execute, it works fine. This is show stopper for us. We need to prepare multiple statements. Does anyone have an example?
$pdo = new PDO("java:comp/env/jdbc/mysql"
$s = "select * from ItemCtlg where Str = :catalog";
$stmt1 = $pdo->prepare($s, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt1->bindParam(':catalog', $Catalog, PDO::PARAM_STR);
$c = "select * from PartsOeStore where Str = :store";
$stmt2 = $pdo->prepare($c, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt2->bindParam(':store', $Store, PDO::PARAM_STR);
$Catalog = 'myCatalog';
$Store = 'myStore';
==> produces error.