Php和MySql从逗号分隔的字符串中选择

I have this:

$string = "battery,lighter,phone";

I have a table users that has each user's tags.

How is it possible to select using sql where tags = $string and where email = '$usermail' ;

I just want to retrieve data based on user email and user stored tags that are separated by comma in the table like the above string

If you are only selecting for one tag you could use

 select bits where tag like '%select_value' and email = 'email_value'

If you need to pick out multiple tags you'll need to parse out the csv. That's a larger challenge.

ANSWER UPDATED: Given the tables as listed in another's comment:

SELECT p.id, p.p_title, p.categoryname, u.id, u.user_email, u.my_choices
  FROM users u
  JOIN products p
    ON FIND_IN_SET(p.categoryname, u.my_choices)
 WHERE u.email = 'email_value'

MySQL has a FIND_IN_SET() function that may suit your purposes. In this particular case, all of the products that have a 'categoryname' within the user's 'my_choices' will be returned.

Let me know if this works for you,

john...