Use Or and AND condition at same time
Use Or and AND condition at same time
orik3ll0
Posts: 36Questions: 12Answers: 2
Hello to All.
I need to use "OR" condition and "AND" condition at same time, but working only that one which is upper. Here is my code, can anyone tell me my error?
->where( function ( $q ) use( $todaydate1, $todaydate, $time, $paa ){
//$q->where('username', $p)
$q->where( 'date', $todaydate1, '=' );
$q->or_where( function ( $r ) use( $todaydate, $time ) {
$r->where( 'date', $todaydate );
$r->where( 'time', $time, '>=' );
} );
} )
->where( 'username', $paa)
How to use them at same time?
This discussion has been closed.
Answers
You need to perform grouping on the conditions: https://editor.datatables.net/docs/1.6.3/php/class-DataTables.Database.Query.html#_where_group .
Click the row in the table for the
where_group
method to see an example of it being used.Allan
Dear @allan,
Can you write me an example where used "AND condition" with "OR condition" in "WHERE_GROUP". I could not exactly understand what I need to use
That will result in:
Allan