开发者

Zend_Db_Table_Abstract delete

I'm trying to del开发者_StackOverflowete a Row, can anyone tell me the proper syntax for this ?

class Application_Model_Event extends Zend_Db_Table_Abstract {

    protected $_name = 'xx';
    protected $_primary = 'xx';

   public function deleteEvent ( $xx) {

        $this->delete( $this->select()->where('idEvent = ?', '8'));

    }
}


To delete row with idEvent value of 8:

$this->delete(Array("idEvent = ?" => 8));

It will do all the proper quoting and sanitising of the values without needing to use the extra quoteInto statement.


No, the delete() function just takes a WHERE condition.

$this->delete("idEvent=8");

Unfortunately, the method doesn't understand the two-argument form like Select objects do. So if you want to interpolate variables into it, you have to do it in two steps:

$where = $this->getAdapter()->quoteInto("idEvent = ?", 8);
$this->delete($where);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜