Bug #80142 [Opn->Nab]: PDO provides no way to get number of rows in result
| From: | daverandom@php.net | Date: | Wed, 23 Sep 2020 17:43:19 +0000 |
| Subject: | Bug #80142 [Opn->Nab]: PDO provides no way to get number of rows in result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229187@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80142&edit=1
ID: 80142
Updated by: daverandom@php.net
Reported by: teo8976 at gmail dot com
Summary: PDO provides no way to get number of rows in result
-Status: Open
+Status: Not a bug
Type: Bug
Package: PDO MySQL
Operating System: all
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2020-09-23 17:43:02] daverandom@php.net
https://www.php.net/manual/en/pdostatement.rowcount.php
------------------------------------------------------------------------
[2020-09-23 17:40:57] teo8976 at gmail dot com
Description:
------------
MySQLi has $result->num_rows that tells you the number of rows in a result. There are countless
use cases for wanting to know the number of results before fetching them (I'm not even saying
"without" fetching them because then you could do a COUNT() query to begin with).
There's no way to do that in PDO.
If you have already executed a query and want to know the number of rows in the result, you need to
fetch them all, or to do an extra COUNT query.
That is ridiculous.
This is a very well known crippling limitation in PDO, how comes it hasn't been fixed yet??
Forums are full of questions like "how to get the row count in PDO", and obviously the
answers are all pathetically insufficient workarounds.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80142&edit=1