I'm struggling with this issue.
I have in mysql a SET field fk_item_types with (10,20,30,40,50,60) values.
I have a php variable $itemtype that i use to filter records with the fk_item_types.
The problem I have is that the filter is not working when I use the variable as filtering value, but it works when I write the value.
"WHERE FIND_IN_SET('30',fk_i_item_type)>0" works ok.
this doesn't work:
"WHERE FIND_IN_SET('$item_type',fk_i_item_type)>0"
"WHERE FIND_IN_SET('{$item_type}',fk_i_item_type)>0"
"WHERE FIND_IN_SET('" . $item_type . "',fk_i_item_type)>0"
using $itype = (string) $item_type doesn't work either.
Using the "LIKE '% %' " alternative doesn't work either.
I appreciate your help.
B/R.
Your var fk_item_types looks like this ?
SET @fk_item_types = '10,20,30,40,50,60';
And add an @ before your variable name in the request.
Also, var_dump your variable $item_type
, just in case.