php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80142 PDO provides no way to get number of rows in result
Submitted: 2020-09-23 17:40 UTC Modified: 2020-09-23 17:43 UTC
From: teo8976 at gmail dot com Assigned:
Status: Not a bug Package: PDO MySQL
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: teo8976 at gmail dot com
New email:
PHP Version: OS:

 

 [2020-09-23 17:40 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-23 17:43 UTC] daverandom@php.net
-Status: Open +Status: Not a bug
 [2020-09-23 17:43 UTC] daverandom@php.net
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.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Dec 03 13:03:38 2021 UTC