当我尝试在magento adminhtml中运行sql查询时,它会提供数据,但是我在其他地方遇到了magento错误

时间:2013-01-16 06:22:47

标签: php zend-framework magento

这是我的代码位于app \ design \ adminhtml \ default \ default \ template \ customer \ tab \ addresses.phtml

    $arrParams = $this->getRequest()->getParams();
    $read = Mage::getSingleton('core/resource')->getConnection('core_read');
    $query = 'SELECT entity_id, parent_id, is_active FROM ' .    Mage::getSingleton('core/resource')->getTableName('customer_address_entity').'
    WHERE parent_id = '.$arrParams['id'];
    $results1 = $read->fetchAll($query);

数据是正确的但是当我尝试在后端创建新客户时会出现错误

(SQLSTATE[42000]: Syntax error or access violation: 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 '' at line 1)

1 个答案:

答案 0 :(得分:0)

$ arrParams ['id']是问题所在。在其他一些地方它是空的。

Thhanks