Search is not working with 2 fields (3 criterias)

QuestionsSearch is not working with 2 fields (3 criterias)
Talha asked 4 years ago

AssalamOAlaikum Abu Ghufran,

I am using the paid version of PHPGrid and finding it difficult to filter the grid with the correct results based on 3 fields.

There are 2 fields A and B. A is of Type varchar and B is int, what I am doing is:

Values for field A = Apple, Mango, Banana, Cherry
Values for field B = 100, 200, 300

1) Apple, 200
2) Apple, 300
3) Mango, 100
4) Mango, 300
5) Banana,100
6) Banana,200
7) Cherry,100
8) Cherry,200

Search type "any"
A contains "apple"
A contains "mango"
B greater than or equal 200

What it does, it returns all the records which are greater than 200 without filtering field A on the given criteria. When i tried filtering/searching without field B, it returned the correct results.

(PS: I am using field A twice in the search)

Looking forward to get an advice.


1 Answers
Abu Ghufran answered 4 years ago

Currently, it is applying ORing on all conditions. And if 3rd condition is met rest are ignored.

I guess, what you need is (a=='apple'||a=='mango') AND (b>200)
For such case, emailing you demo and updated lib (lib/inc folder).

Your Answer

17 + 3 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!