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";
}
}
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";
}
}