mysql - Select record using FIND_IN_SET -


I am storing the check box value, such as a comma-separated value in DB such as

  1 Features, 3,4 1,2,3,4,5 3,4,5,6   

Now when I search for the user to select the check box The requirement is, for example, if the user matches 1 and 6 then the match record must be received by me like (0 = & gt; 1,1 = & gt; 6) Receiving selected check value in the form. I do not know how to loop through FIND_IN_SET (1, FEATURES) or FIND_IN_SET (6, FEATURES)

It is about to come

 < Code> SELECT * to table WHERE FIND_IN_SET (1, attributes) or FIND_IN_SET (6, attributes)    

<> $ str = '%' ex; Foreach ($ val as $ val) {$ str. = $ Val. '%';} SELECT * from table where features like $ str

:

  $ str = ''; Foreach ($ val as $ val) {$ str. = 'Or like feature%' $ Val '%';} $ Str [0] = ''; $ Str [1] = ''; The table from SELECT * where $ str    

Comments