I have a problem with my mysql filter. If user has an empty field, the query doesn't work. How can I fix this, I have tried sending 'NULL' at type if type not selected, but this doesn't work too.
$STH = $DBH->query("
SELECT *
WHERE store ='$type' and sdn='$status' and price>='$price_s' and price<='$price_e' ORDER BY id DESC LIMIT $setlimit");
$STH = $DBH->query("
SELECT *
WHERE store ='$type' and sdn='$status' and price>='$price_s' and price<='$price_e' ORDER BY id DESC LIMIT $setlimit");