Reputation: 378
I'm trying to delete 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'));
}
}
Upvotes: 3
Views: 3225
Reputation: 1504
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.
Upvotes: 11
Reputation: 562348
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);
Upvotes: 8