WHERE Clause, AND & OR operators
WHERE Clause, AND & OR operators
Hi, I'm trying to write a WHERE clause with OR and AND operators but have been unsuccessful. Please help. I'm looking for way to filter sql data for rows that have:
1. the specified ID, and
2. Not inactive, and
3. Either has value A, B, C, or D
The code below didn't work as well as several other variation that I tried.
->where( function ( $q ) {
$q->where('ID',$_GET['ID']);
->where('inactive','0');
->or_where( function ( $r ) {
$r->where( 'Type', 'A' );
$r->where( 'Type', 'B' );
$r->where( 'Type', 'C' );
$r->where( 'Type', 'D' );
} );
} );
Thank you.
This discussion has been closed.
Answers
Try:
Allan
Thanks for the suggestion Allan, but that still doesn't work. I'm still getting the invalid JSON response error.
Can you show me what the server is responding with - it is probably an error message if it isn't valid JSON?
Allan