0

enter image description here

public function listAction()
{  
    $resource = Mage::getSingleton('core/resource');
    $readConnection = $resource->getConnection('core_read');       
    $qur = 'SELECT * FROM nmcatalog_category_product where category_id = 3 AND product_id = 1';
    $results1 = $readConnection->fetchAll($qur);
    if(!empty($results1)){
      $writeConnection = $resource->getConnection('core_write');
      $updatequry = 'UPDATE nmcatalog_category_product SET position = 6 where category_id = 3 AND product_id = 1';
      $updateresult = $writeConnection->fetchAll($updatequry);
    }else{
      echo "Array Empty";
    }

}
0

Use below code:

change fetchAll with query

public function listAction()
{  
    $resource = Mage::getSingleton('core/resource');
    $readConnection = $resource->getConnection('core_read');       
    $qur = 'SELECT * FROM nmcatalog_category_product where category_id = 3 AND product_id = 1';
    $results1 = $readConnection->fetchAll($qur);
    if(!empty($results1)){
      $writeConnection = $resource->getConnection('core_write');
      $updatequry = 'UPDATE nmcatalog_category_product SET position = 6 where category_id = 3 AND product_id = 1';
      $updateresult = $writeConnection->query($updatequry);
    }else{
      echo "Array Empty";
    }

}

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.