Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework: How to delete a table row where multiple things are true?

Normally, this would work for me:

$db = Zend_Db_Table::getDefaultAdapter(); $where = $db->quoteInto('id = ?', $id); $db->delete('tablename', $where); 

but I have to match two ids. So I don't really know how to structure it.

WHERE first_id = 'id1' AND second_id = 'id2' 

So how do I do this with the Zend Framework?

like image 550
Andrew Avatar asked Dec 04 '09 06:12

Andrew


1 Answers

To extend on Jason W's answer:

Not exactly sure what the 3rd section is saying

That means you can do this:

$db->delete('tablename', array(     'first_id = ?' => $first_id,     'second_id = ?' => $second_id )); 

And the adapter will quote everything for you.

I don't feel like the documentation is very clear though.

like image 58
smack0007 Avatar answered Sep 22 '22 02:09

smack0007