在Zend框架中,如何检查zend_db_select
是否返回结果?如何检查Zend select是否返回结果
$result = $this->fetchAll();
有没有更好的办法,而不是使用:
if(count($result) != 0){
//result found!
}
在Zend框架中,如何检查zend_db_select
是否返回结果?如何检查Zend select是否返回结果
$result = $this->fetchAll();
有没有更好的办法,而不是使用:
if(count($result) != 0){
//result found!
}
$rows = $this->fetchAll();
return (!empty($rows)) ? $rows : null;
我喜欢用经典:
//most of these queries return either an object (Rowset or Row) or FALSE
if (!$result){
//do some stuff
} else {
return $result;
}
方法返回NULL,而不是FALSE。使用if条件检查此值。
你在这里展示的方法有什么问题? – 2012-02-23 07:43:41
我在找一个更好的方法。 – rjmcb 2013-07-03 07:23:19