How to create WHERE IN clause with Zend_Db_Select

xelurg picture xelurg · Dec 4, 2008 · Viewed 41.4k times · Source

So I am trying to accomplish something like this:

SELECT * FROM table WHERE status_id IN (1,3,4);

using Zend_Db_Select... can't find how to do it :( Is it at all possible?

Answer

Martin Rázus picture Martin Rázus · Dec 12, 2008

you can also use it like this:

$data = array(1,3,4);
$select->where('status_id IN(?)', $data);

you dont need to implode array, and it's safer