I know this question has been asked many times, but I\'ve read the answers to many of the questions and still cannot understand why I am receiving this error:
you need to fetch until a row fetch attempt fails. I know you may only have one row in the result set and think one fetch is enough, but its not.
you probably have other statements where you didn't fully "fetch until a fetch failed". Yes, i see that you fetch until the fetch failed for one of the statements.
also, see closecursor()
$sql = "select * from test.a limit 1";
$stmt = $dbh->prepare($sql);
$stmt->execute(array());
$row = $stmt->fetch();
$stmt->closeCursor();
or
$sql = "select * from test.a limit 1";
$stmt = $dbh->prepare($sql);
$stmt->execute(array());
list($row) = $stmt->fetchAll(); //tricky