From: nitinvaishnav at gmail dot com
Operating system: windows 2000
PHP version: 5.1.1
PHP Bug Type: PDO related
Bug description: pdo_mysql->rowCount does not work with Select
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 bug report at http://bugs.php.net/?id=35529&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=35529&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=35529&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=35529&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35529&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=35529&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35529&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35529&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35529&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35529&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35529&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35529&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35529&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35529&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35529&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35529&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35529&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35529&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35529&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35529&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35529&r=mysqlcfg