Hi there,
I am wanting to know if there is an easy way to do a count_records_select which has an AND clause which i would like to be met, then after that check if any of the OR clause statements are met. Unfortunately when i try doing this it seems to match the AND clause or any of the OR clauses, when i want it to only output if the AND clause is met with any OR clause
Shown below is the code i am trying on a custom made table; for some reason it keeps returning true if none of the OR clauses are met when i don't want it to do this:
if ($DB->count_records_select('user_criteria', 'userid = ? AND criteriaid = ? AND (valueid = ? OR valueid = ? OR valueid = ? OR valueid = ?)', array($student->id, $unitcrit->id, 289, 288,287,286)))
{
$unitstatus = " - PA";
}
for some reason $unitstatus is always equaling PA when userid and criteriaid are true, even if the OR is not met. Any ideas?
I would have tried a get_records_list but you cannot have an AND clause in there too can you?
Many thanks,
Mark