PDO rowCount problem
Posted: Tue Sep 09, 2008 12:45 pm
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
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
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;
Thank You