In Zend framework, how do I check if zend_db_select
returns a result or not?
$result = $this->fetchAll();
is there a better way rather than using:
if(count($result) != 0){
//result found!
}
$rows = $this->fetchAll();
return (!empty($rows)) ? $rows : null;
I like to use the classic:
//most of these queries return either an object (Rowset or Row) or FALSE
if (!$result){
//do some stuff
} else {
return $result;
}
I've found this way and works fine for me :
if($result->count() > 0) {
//Do something
}
Thanks to Åsmund !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With