Or_where array
Or_where array
nico077
Posts: 55Questions: 14Answers: 2
Hello Allan,
I have a little question.
Can I use a or_where with an array.
Example :
->where( function ($q) {
$q->or_where( 'column1', 'value1', '=' );
$q->or_where( 'column2', 'value2', '=' );
} )
--> It's work
But when i use:
->where( function ($q) {
$q->or_where( 'column1', array('value1','value2'), '=' );
} )
Best Regards,
Nicolas
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I find this link :
https://datatables.net/forums/discussion/24880/where-in-clause-on-server-side
Yes. See also the complex conditional part of the manual.
Allan
Thank you Allan,
Finally, i do it like this :
->where( function ($q) {
foreach ($array as $value){
$q->or_where( 'id1', $value, '=' );
}
} )
->where( function ($q) {
$q->and_where( 'id2', $value2, '=' );
} )