Zend Framework

Zend Framework – Zend_Db In Clause

I really thought it was hard to implement the IN clause in Zend Db Select, but after a few research, it was very easy just like the other clause in the WHERE clause.

All you need is an array then pass it to where() just like any other parameters. The put the question mark inside the parenthesis of your IN clause.

//sample parameter, a numeric key array
$params = array('3010001', '3010002', '3010003', '3010004');
//this example uses Zend_Db_Table
$select = $table->select()
    ->where('Scan_Number IN(?)', $params);

//the rest of the code

As simple as that.

4 thoughts on “Zend Framework – Zend_Db In Clause”

Leave a reply

Your email address will not be published. Required fields are marked *