|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40822 pdo rowcount bug
Submitted: 2007-03-15 15:34 UTC Modified: 2007-04-08 15:26 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: vitaliy dot okulov at gmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.1 OS: Gentoo Linux 2006.1
Private report: No CVE-ID:
 [2007-03-15 15:34 UTC] vitaliy dot okulov at gmail dot com
Using PDO DBLIB driver to connect to MySQL server each SELECT query I've
tried this far returns a valid resultset but PDOStatement::rowCount()
always returns 0.

When i use php 5.1.6 all works fine.

Reproduce code:

        $db = new PDO("mysql:host=xxx;dbname=xxx", "xxx", "xxx",  array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));

        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $r = $db->query("SELECT * FROM xxx");
        echo "<pre>";
        echo "rowCount = ".$r->rowCount();
        echo "</pre>";


Expected result:
rowCount = 540554

Actual result:
rowCount = 0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-08 15:26 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 00:01:33 2015 UTC