2011-07-03 20 views
2

行を更新する際に問題があります。Zend_Db_Adapter_Abstract :: update()は配列でなければなりません

私のクラスには、ここで取得Zend_Db_Table_Abstract

を延長している私のコードです:

return $this->update(
      array('data' => $data), 
      $this->getAdapter()->quoteInto("id = ?", $id) 
     ) ? true : false; 

私は入れません例外がある: 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

私もそれに配列を渡してみましたが、何も起こりません。何か案が?!

答えて

0

あなたはの第2引数に配列を使用することができます - >更新()

例:

$this->update(
    array('data' => $data), 
    array("id = ?" => $id), 
) ? true : false; 

が、文字列でなければなりませんOK

/** 
* 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); 
    } 
becouse
関連する問題