By default, if you pass in an array of WHERE conditions, Zend_Db assumes you're using AND. But you can also pass in a complete WHERE condition with OR:
$db->delete($table, "id = 1 OR parentid = 1");
With Zend_Db_Table:
$table->delete("id = 1 OR parentid = 1");
But don't forget to quote the parameters:
$db = $table->getAdapter();
$table->delete("id = {$db->quote($id)} OR parentid = {$db->quote($id)}");
--
Hector
--
Hector
On Thu, Jan 14, 2010 at 10:26 PM, Erdal YAZICIOGLU <erdal.yazicioglu@gmail.com> wrote:
Can somebody give me example of writing multi condition delete with ZF 1.9. Especially with OR.
Delete from table where id=1 or parentid =1
Thanks
没有评论:
发表评论