I’m writing this message because I ran out of ideas regarding the implementation of the following thing: given a table with products and another one with product filters, I’d like to retrieve the products according to the selected filters.
Tables look like this:
products:
p_id,
p_name,
p_image
product_filters:
pf_id,
pf_product_id,
pf_filter_id,
pf_filter_value
There is a third table with filter name and id but it’s not so important.
From the HTML form I get an array with filter id and filter value.
I tried to retrieve the id of the products that matched a selected filter, but it only works file for one selected filter. If there are more than one selected filter I won’t get any result.
I’m using PHP and MySQL.
Thanks.
I’m thinking about creating a query like this:
that should do the trick ( although it isn’t the prettiest way to solve it probably )