As part of Zend, how do I check if a zend_db_selectresult returns or not?
zend_db_select
$result = $this->fetchAll();
there is a better way than using:
if(count($result) != 0){ //result found! }
$rows = $this->fetchAll(); return (!empty($rows)) ? $rows : null;
I like to use classics:
//most of these queries return either an object (Rowset or Row) or FALSE if (!$result){ //do some stuff } else { return $result; }
I found this method and worked fine for me:
if($result->count() > 0) { //Do something }
Thanks Åsmund !
The method returns NULL, not FALSE. Verify this value using the if condition.