i read this blog and developed ajax filter. but i am not able filter after mixing 2 conditions(i.e. i wand OR condition with AND condition)
Like someone click 3 check-boxes :- bs , cs , ec
then filter condition like this where bs = 1 and cs =1 or ec = 1
but my result only gives result of where bs = 1 and cs =1 and ec =1
please help me !
i see no use of an or condition in your script. you also have to use appropriate brackets if you don’t want to rely on the default precedences: and > or. further you have type mismatches - you are speaking of x = 1 but the script says x = yes for the flag.
sorry for writing x = 1 in description, that is x = “yes”. means where cs=“yes”. please refer code
i am getting problem, when i am including or condition. i am not able to figure out how to include or condition
for the condition like - where bs=“1” and cs=“yes” or ec=“yes”
i.e. bs must be 1(true) and either cs or ec should be present or both should be present.
please help me in this condition.
if(in_array("bs", $opts) && in_array("ec", $opts) && in_array("cs", $opts)){
$where .= " AND (bs = '1' AND ( cs = 'yes' OR ec='yes' )) OR (bs='1' AND( ec='yes' OR cs='yes')) OR (bs='1' AND (ec='yes' AND cs='yes') ) ";
}
but it is not efficient when we have 1000 of branches like cs,ec,mec,civil and we want or condition of branches with program like bs='1' and ec='yes' or cs='yes' or mec='yes'
please help me !