我的getCollection代碼提供了錯誤的查詢字符串(我認爲)。Magento:過濾getCollection不起作用
我有一張桌子叫橫幅,我可以從容易加載所有記錄。當我嘗試過濾它時,我收到錯誤。
下面是代碼:
$banner = Mage::getModel('banner/banner')->getCollection()->addFieldToFilter('group', array('eq'=>'search_group'));
頁面崩潰,我得到這個錯誤:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group = 'search_group')' at line 1";i:1;s
正如你所看到的,好像代碼是搞亂組後的報價。
'group = 'search_group')'
任何人都可以建議如何解決這個問題?
感謝,
比利
請注意我也試過'喜歡'而不是'eq'.. – iamjonesy 2011-02-17 16:45:06