B
B
Barmunk2017-08-01 15:21:22
PHP
Barmunk, 2017-08-01 15:21:22

How to fix PDO DBLIB: dbresults() returned FAIL?

There is a resulting procedure with a data set. I don't know the exact number of lines. To get them I use nextRowset() in a loop, as written in the doc. However, depending on the version of php (5.6.31) I am catching an error in the last iteration SQLSTATE[HY000]: General error: PDO_DBLIB: dbresults() returned FAIL . I found a couple of bug reports on this issue on Google and an indistinct answer to https://stackoverflow.com/questions/38012890/pdo-d... but something doesn't work.
tried like this:

do {
  $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
  if ($rows) {
    $arr[] = $rows;
  }
} while ($stmt->nextRowset());

so:
while ($pdo->columnCount()) {
    $data[] = $pdo->fetchAll(PDO::FETCH_ASSOC); //or, $pdo->fetchAll() 
    $pdo->nextRowset();
}

On Windows it works fine, on prod it already throws an error.
https://bugs.php.net/bug.php?id=72488 found a similar bug, but complete silence

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2017-08-01
@Barmunk

while ($stmt->nextRowset() && $stmt->columnCount());

Calling stored procedures in PDO

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question