PDO rowCount problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

PDO rowCount problem

Post by dude81 »

I run on my windows developement machine PHP 5.2.6 while I've a linux box of with 5.1.6.
I've the following code
here connectionString is PDO object

Code: Select all

 
             try{
                        $stmt = $this->connectionString->prepare($query);
                        $stmt->execute($params);
                     //   print_r($stmt->fetchAll())      ;
                } catch(PDOException $e){
                        echo $e->getMessage();
                        exit;
                }
 
                $result = array();
                for($i=0; $i<$stmt->rowCount();$i++){
                        $result[] = $stmt->fetchObject('MyClass');
                }
                return $result;
 
 
seems to work fine with windows platform, but I'm having a tough time dealing it on the linux box. On Linux box print_r($stmt->fetchAll()) gets the data, but the below code is what I'm expecting it work. Could somebody help on this.

Thank You
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: PDO rowCount problem

Post by dude81 »

Dude... solution is this http://bugs.php.net/bug.php?id=40822
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: PDO rowCount problem

Post by dude81 »

Nope, this was not the solution use of array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true) at the PDO Connection solved the problem
Post Reply