简体   繁体   中英

When i try to run a sql query in magento adminhtml it gives the data, but i'm getting a magento error some where else

This is my code located in 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);

data is correct but when I try to create new customer in the backend it gives an error

(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)

$arrParams['id'] was the problem. It was null at some other location.

Thhanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM