I have 1 mysql table called colors with rows id and name
1 - yellow 2 - black 3 - red 4 - green 5 - white 6 - blue
How can I get array of IDs if I have, for example, search string
["colors"]=> string(14) "blue,red,white"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set
NB: as per Dan’s comment below, this query doesn’t use indexes and will be slow on a large table. A query with IN is better: