ID:               35529
 User updated by:  nitinvaishnav at gmail dot com
 Reported By:      nitinvaishnav at gmail dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: windows 2000
 PHP Version:      5.1.1
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to