enter image description here

Whem i am trying to fetch sql query in my magento's controller it's display this error

SQLSTATE[HY000]: General error

HERE is my code

    $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
    $sql = "DELETE FROM marketplace_sellernotification WHERE seller_id =".$sellerId;
    $rows = $connection->fetchAll($sql);
    header('Location: ' . $_SERVER['HTTP_REFERER']);
  • try this code:-my.cnf settings that might help… max_allowed_packet = 16M wait_timeout = 1800 connect_timeout = 120 – Ashvin Monpara Jul 2 '15 at 11:10
  • please tell me code of line 1362 at SellerController.php – Amit Bera Jul 2 '15 at 11:10
  • $rows = $connection->fetchAll($sql); – Magento Jul 2 '15 at 11:12
  • I hope you are sanitizing $sellerId to always be an integer. Better: use prepared statements. Even better: use the appropiate Magento resource model. – Fabian Schmengler Jul 2 '15 at 11:25

Hi first you need change core_read to core_write

$connection = Mage::getSingleton('core/resource')->getConnection('core_read'); 


$connection = Mage::getSingleton('core/resource')->getConnection('core_write'); 

Now run query by checking carefully ,sure it will work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.