我直接在phpmyadmin中运行此查询,它完全返回结果!! 但是当我在我的php脚本中运行此查询时,它返回 NULL
这是我的db类:
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;
}
}
答案 0 :(得分:0)
echo $this->masterMenu["id"];
但正确的方法是:
foreach ($this->masterMenu as $key => $value)
{
$masterMenu = $value['id'];
}