I want to search multiple values from database field.
below is my query.
For example
_$Shape = Makeable2,Clivage Brn_ ;
_$Color = GHI,JKL_
SELECT * FROM inventory WHERE Shape IN ($Shape) OR Color IN ($Color)
I want to search multiple values from database field.
below is my query.
For example
_$Shape = Makeable2,Clivage Brn_ ;
_$Color = GHI,JKL_
SELECT * FROM inventory WHERE Shape IN ($Shape) OR Color IN ($Color)
I wrote my answer, and I see you now edited the post, still going to post what I wrote.
Not sure what it is you want to do exactly. But here an example of what I think it is you wish to achieve. Assuming that all values in your array are sanitized... This query would work. As said before by others, you need to create an array with all the values you would like to search for. Adjust to suit your needs.
$ArrayA = array("round", "circle", "something");
$ArrayB = array("red" , "green");
$sql = "SELECT * FROM inventory WHERE Shape IN ('".implode("','",$ArrayA)."') OR Color IN ('".implode("','",$ArrayB)."')";
Database layout example;
id Shape Color
1 round red
2 round blue
3 square red
4 square green
5 circle blue
6 circle red
7 circle green
8 something blue
9 something green