I have an array of user-defined values stored in an extended user field:
[0] = Red, [1] = Blue, [2] = Green etc.
I’m trying to construct a query in the following format:
where ( type = ’box’ AND size = ’large’ AND ( color LIKE ’red’ OR color LIKE ’blue’ OR color LIKE ’green’ ) )
The reason the color conditions need to be LIKE as opposed to = is because my boxes can be multi-colored and the color field in the table I’m querying contains a comma-delimited list of colors (e.g. red,green).
I need to create the final AND () condition from the array. I have tried several solutions using looping orconditions and nested arrays but the syntax is always wrong, with brackets not appearing correctly.
Any ideas would be very gratefully welcomed.