note 123030 rejected from pdostatement.nextrowset by cmb
| From: | cmb@php.net | Date: | Thu, 03 Sep 2020 10:35:37 +0000 |
| Subject: | note 123030 rejected from pdostatement.nextrowset by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215064@lists.php.net to get a copy of this message | ||
Note Submitter: a dot naschekin at mypsw dot ru
----
When you call $stmt->nextRowset(); it returns TRUE every time and does not stop with FALSE even
when no more results left.
It causes Fatal Error when calling
$results[] = $stmt->fetchAll(PDO::FETCH_ASSOC);
with error message
"PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error in
..."
unable to fetch result which not exists.
The desission is try {} catch(e) {}
$stmt = pdo->query("Call Get_multi_result();");
do {
try {
$streets[] = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
}
} while ($stmt->nextRowset());