Answer the question
In order to leave comments, you need to log in
How to find a product by Mysql colors?
I have goods in the db and it has a colors field in which I write like this black,yellow,green, etc. and I have an array of colors selected by a person, how to take those products that have all the colors from the array in the field?
Answer the question
In order to leave comments, you need to log in
There should not be a field "which I write like this black,yellow,green ".
There must be a separate table , in which the record id and color,
then the search is done by a simple join.
Use SQL queries, you can search by several criteria at once
SELECT * FROM [Шарики] WHERE [Цвет] IN ('Красный','Зеленый','Белый','Синий')
Binary "mask" becomes an id-shnik for the aggregate set.
1+2+4+8+16+32+........
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question