How can I write query like this In Zend Framework and fetch all the rows
SELECT * FROM tbl
WHERE user_id = $part_mail
OR user_id ='$id3';
I used to try this :
$select = $tigaseModel->fetchAll($tigaseModel
->select()
->where('user_id = ?', $part_mail )
-> orwhere('user_id = ?', $id3 ));
Following ways should help you.
Solution 1:
where( "user_id = '$part_mail' OR user_id = '$id3'" );
Solution 2:
$list = array( $part_mail, $id3 );
...
where( 'user_id in ( ? )', $list );
Solution 3:
$list = array( $part_mail, $id3 );
...
where( array( 'user_id' => $list ) );
Refer to Documentation:
Example #17 Example of an array parameter in the where() method
-You can pass an array as the second parameter to the where() method when using the SQL IN operator.