Page 1 of 1

PDO rowCount problem

Posted: Tue Sep 09, 2008 12:45 pm
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

Re: PDO rowCount problem

Posted: Tue Sep 09, 2008 1:30 pm
by dude81
Dude... solution is this http://bugs.php.net/bug.php?id=40822

Re: PDO rowCount problem

Posted: Wed Sep 10, 2008 4:30 pm
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