我们可以在Zends delete()中使用多个where子句吗?

问题描述:

I am trying to use multiple where() with Zends delete(), but nothing is happening..!!!

$where=array('id' => $id,'likedbyID' => $likedbyID);
$this->delete($where);

The above code is written inside a Model.

Please help me.....

Thanks in advance.....

我正在尝试使用多个where()和Zends delete(),但什么也没发生.. !!! p>

  $ where = array('id'=> $ id,'likesbyID'=> $ likesbyID); 
 $ this-> delete($ where)  ; 
  code>  pre> 
 
 

上面的代码写在模型中。 p>

请帮帮我...... p>

提前致谢..... p> div>

From zend documentation :

Since the table delete() method proxies to the database adapter delete() method, the argument can also be an array of SQL expressions. The expressions are combined as Boolean terms using an AND operator.

Knowing all that you can use it like this :

$this->delete(
    array(
        'id = ?' => $id,
        'likedbyID = ?' => $likedbyID,
    )
);

Allso you could use the > or < or IN or .. operators instead of =