Hi,
I’m having an issue with database queries in one of my applications since migrating to Rocket PHP. When running the below code, I used to get a record from the DB2 table split into the $subject, $authorname, $authorid, and $message variables; but now I’m getting NULL for each one. Here is the code that is experiencing the issue:
$query = "SELECT SUBJECT,AUTHOR,USERID,BODY FROM $_SESSION[DATABASE] WHERE NUMBER=$tm";
putenv("DSNAOINI=$_SESSION[DB2INI]");
$dbh = new PDO($_SESSION['DB2SSID'],$_SESSION['APPID'],$_SESSION['APPPW'],array('PDO_ATTR_PERSISTENT' => false));
$dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$sth=$dbh->prepare($query);
$sth->execute();
$sth->bindColumn(1,$subject);
$sth->bindColumn(2,$authorname);
$sth->bindColumn(3,$authorid);
$sth->bindColumn(4,$message);
$sth->fetch(PDO::FETCH_BOUND);
$sth = NULL;
$dbh = NULL;
I’ve tried using the actual column names instead of binding them by number and that didn’t help. I also tried converting from PDO::FETCH_BOUND to PDO::FETCH_ASSOC which fixed the first 3 columns, but it introduced a new problem where the 4th column wouldn’t come back because it is a CLOB. I think I need to keep using the bindColumn() and PDO::FETCH_BOUND to get the CLOB to retrieve properly. I’m not getting any bad completion codes after the database handle or statement objects are created.
Thank you for your help,
Chris