#35529 [Opn->Fbk]: pdo_mysql->rowCount does not work with Select

From: Date: Sat, 03 Dec 2005 12:07:41 +0000
Subject: #35529 [Opn->Fbk]: pdo_mysql->rowCount does not work with Select
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89672@lists.php.net to get a copy of this message
ID: 35529 Updated by: tony2001@php.net Reported By: nitinvaishnav at gmail dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: windows 2000 PHP Version: 5.1.1 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-12-03 08:30:45] nitinvaishnav at gmail dot com I using php 5.1.1 on IIS with mysql 4.1.10a. The test database have 3 rows, the rowCount function returns 0, but foreach dumps 3 records of the table. But the rowCount returns correct result with INSERT, UPDATE and DELETE. ------------------------------------------------------------------------ [2005-12-03 08:29:23] nitinvaishnav at gmail dot com Description: ------------ I using php 5.1.1 on IIS with 4.1.10a. The test database have 3 rows, the rowCount function returns 0, but foreach dumps 3 records of the table. But the rowCount returns correct result with INSERT, UPDATE and DELETE. Reproduce code: --------------- $Con = new PDO('mysql:host=localhost;dbname=nitin', 'root', ''); $Res = $Con->query('select * from test'); echo('rowCount: ' . $Res->rowCount() . "\n\n"); foreach ($Res as $Record) { var_dump($Record); } Expected result: ---------------- rowCount: 3 array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } Actual result: -------------- rowCount: 0 array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } array(2) { ["test_int1"]=> string(1) "1" [0]=> string(1) "1" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35529&edit=1

« previous php.bugs (#89672) next »