Zend_Db_Adapter_Abstract::update() must be an array
I am having some trouble updating a row.
My class is extending Zend_Db_Table_Abstract
开发者_如何学编程Here is my code:
return $this->update(
array('data' => $data),
$this->getAdapter()->quoteInto("id = ?", $id)
) ? true : false;
The exception I keep getting is:
PHP Catchable fatal error: Argument 2 passed to Zend_Db_Adapter_Abstract::update() must be an array, string given, called in /Applications/MAMP/htdocs/app/library/Session/Handler.php on line 51 and defined in /Applications/MAMP/libraries/zend-framework/ZendFramework-1.11.3-minimal/library/Zend/Db/Adapter/Abstract.php on line 587
I tried passing it an array also but nothing happens. Any idea?!
You may use array in second argument of ->update()
example:
$this->update(
array('data' => $data),
array("id = ?" => $id),
) ? true : false;
but the string must be ok
becouse
/**
* Convert an array, string, or Zend_Db_Expr object
* into a string to put in a WHERE clause.
*
* @param mixed $where
* @return string
*/
protected function _whereExpr($where)
{
if (empty($where)) {
return $where;
}
**if (!is_array($where)) {**
$where = array($where);
}
精彩评论