I have the following code:
$dbh = new PDO(\"mysql:host=$host;dbname=$dbname\", $user, $pass);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$dbh->
It seems that you have PDO::MYSQL_ATTR_USE_BUFFERED_QUERY
set to FALSE.
And in such a case it is obligatory to make sure that there are no more rows pending for the retrieval. To do so one to run fetch()
one extra time, as it seems that fetch()
returning false is "releasing" non-buffered resultset somehow. Without such extra call non-buffered resultset remains locked and causing "Commands out of sync" error