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