I need to build a query that will query tblProduct and return only products that have all the "features" that are passed through the querystring array ($_GET['features']).
For example, what obviously doesn't work is this:
what I need to say is, WHERE the products in DB have all the features in the $_GET['feature'] array.
The 2 problems I see are:
1. Cannot use $_GET['features'] array in a query.
2. I'm not looking IN the $_GET['features'], but in the DB tables, based on values in $_GET['features'].
Can anyone help?
For example, what obviously doesn't work is this:
Code:
$qryGetProducts = "SELECT id, category, company, model, title, description, picture, price, sale_price, available
FROM tblProduct
INNER JOIN tblFeature
ON tblProduct.id_Product = tblFeature.id_Product
WHERE tblFeature.id_Feature IN ({$_GET['features']})
ORDER BY id DESC";
what I need to say is, WHERE the products in DB have all the features in the $_GET['feature'] array.
The 2 problems I see are:
1. Cannot use $_GET['features'] array in a query.
2. I'm not looking IN the $_GET['features'], but in the DB tables, based on values in $_GET['features'].
Can anyone help?