This problem is proceeding to drive me crazy...
First a disclaimer, I have very little formal programming training. I am stumbling thru this.
I am receiving the General error: 2014 error; at first it was one particular query (which was established in a class) and the warning was dependent upon where in the code I was instantiating the object. I proceeded to change every query to a fetchAll and then closed the cursor for every query as well after the fetchAll didn't work. Now there are two offending queries. Here is a copy and paste of one:
(UPDATED CODE):
$sql = "select initial_state from source_nodes where id = :id";
$core = Core::getInstance();
$stmt = $core->dbh->prepare($sql);
$stmt->bindParam(':id', $allSources->id[$id], PDO::PARAM_INT);
if ($stmt->execute()) {
$row = $stmt->fetchAll();
$stmt->closeCursor();
foreach($row as $i=>$value){
$allSources->state[$id] = $row[$i]['initial_state'];
}
}
Not certain if it matters, but the warning is thrown on the 'if'. As far as I am aware, every 'fetch' is now a 'fetchAll' and includes a 'closeCursor'.
The connection is being set like this:
$this->dbh = new PDO($dsn, $user, $password, array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY =>true
));
Suggestions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…