0

I am updating the db table using below code but it does not seem to working fine.

$model = new Admin_Model_DbTable_SmsTemplate();
$where =   $model->getDbTable()->getAdapter()->quoteInto('id = ?', $id);
$model->getDbTable()->update(array('content'=>$content), $where);

what is the error in this code as it is giving affected rows zero.

Thanks.

Manish Jangir
  • 5,329
  • 4
  • 42
  • 75

1 Answers1

0

When using Zend_Db_table IN ZF1. You can achieve it like this:-

    $db=Zend_Db_Table::getDefaultAdapter();
    $model = new  Admin_Model_DbTable_SmsTemplate($db);
    $where = 'id = ' . $id;
    $model->update(array('content'=>$content), $where);

OR

$db=Zend_Db_Table::getDefaultAdapter();
$where = 'id = ' . $id;
$db->update('YourTableName', array('content = ?' => $content,),
            $where
           );

And the adapter will do quote work for you.

Mubo
  • 1,078
  • 8
  • 16