zend中的execute查询返回null


execute query in zend returns null

我直接在phpmyadmin中运行这个查询,它完美地返回了结果!!但是当我在php脚本中运行这个查询时,它会返回NULL

这是我的数据库类:

class Product extends Places_Db_Table_Row_Observable  {
    protected $_name = 'product';
    PUBLIC function getMaxSubcatProduct()
    {

        $query = $this->getAdapter()->query("select  max( c ) AS maxcount,id from ( select COUNT(*) as c 
                    ,product_sub_category_id as id  from product group by product_sub_category_id ) as max ");
        $res = $query->fetchAll();
        return $res;
    }
}

这是我的错!我在我的脚本中显示了这样的结果:

echo $this->masterMenu["id"];

但正确的方法是:

foreach ($this->masterMenu as $key => $value)
                    {
                        $masterMenu =    $value['id'];
                    }