ID:               43586
 User updated by:  vicrry at yahoo dot com dot hk
 Reported By:      vicrry at yahoo dot com dot hk
 Status:           Open
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2.5
 New Comment:

I believe the following definition will surely cause what I mentioned.

-- ------------------------------------ --
TEST_TABLE ( id int(12) PRIMARY KEY );
TEST_TABLE2 ( id int(12) PRIMARY KEY );
-- ------------------------------------ --

In fact it occurs on every foreach I used on any table in my database.


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

[2007-12-18 15:17:58] [EMAIL PROTECTED]

Hello,

Can you please send me your SQL definition for TEST_TABLE and
TEST_TABLE2?



------------------------------------------------------------------------

[2007-12-13 07:08:36] vicrry at yahoo dot com dot hk

Description:
------------
It seems the cursor didn't close after iterated through with foreach
statement, but I don't insist any other causes.

I don't know if it is expected, but it really cause inconvenience and
reduce readability to add a fetchAll() line after every query.

Reproduce code:
---------------
$Pdo = new PDO('mysql:host=localhost,dbname=test');

$res=$Pdo->query('SELECT * FROM TEST_TABLE');
foreach($res as $row) print_r($row);

$res=$Pdo->query('SELECT * FROM TEST_TABLE2');
foreach($res as $row) print_r($row);

Expected result:
----------------
Prints out each row in table 'TEST_TABLE' and 'TEST_TABLE2'.

Actual result:
--------------
The first query seems works fine, though it might have error info left
unprinted.

The second query doesn't work at all, and the query() statement didn't
even report an error.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43586&edit=1

Reply via email to