Compound WHERE Clause
Compound WHERE Clause
I need to filter records with more than one parameter to the "WHERE" Clause. I am assuming this would require an "AND" component however am not able to determine how to do it. My code is as follows:
if (isset($_GET['gridNumber']) && $_GET['gridNumber']==1 && isset($_GET['varAllEmployees']) && $_GET['varAllEmployees']=='y') {
$editor->where($key = 'userNotVaildDate', $value = '', $op = '!=' ); // Filters for all employees
} else {
$editor->where($key = 'userNotVaildDate', $value = '', $op = '=' ); // Filters for terminated and current employees (not correct at present)
}
Please let me know if any additional information is needed for a solution. Any help is appreciated.
Thanks,
Steve
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You can just call
where()
multiple times :-)Or something like that (depending on your keys :-) ).
Allan
I would also like to do the following:
However I receive the following error:
"<b>Parse error</b>: syntax error, unexpected T_IF in "
The
->
operator is a method call in PHP, So you would want to do$editor->where( ... )
etc.otherwise, as PHP says, it is a syntax error :-)
Allan
Thanks Allan