2012-07-24 97 views
0

我直接在phpmyadmin中運行此查詢,它完全返回結果! 但是當我在我的PHP腳本運行此查詢,它返回NULL 在zend中執行查詢返回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

您好,請寫出了「大衆」在較低的情況下,這是建議,我嘗試解決您的問題 – Jalpesh 2012-07-24 09:25:36

+0

沒有改變!!它返回null – afsane 2012-07-24 15:53:40

回答

0

這是我的錯!我得到了下述結果在我的腳本是這樣的:

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

但正確的做法是:

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