I run this query directly in phpmyadmin , it perfectly returns result !!
but when I run this query in my php script , it returns NULL
this is my db class:
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;
}
}
this was my fault! I showed the result in my script like this :
but correct way is: