Is it possible to dynamically modify the where criteria based on what the user selects? I'm creating a form that has a few dropdowns. For example, given the query below, a client can search the database for properties based on price, neighorhood and type of property (i.e. condo, townhome, single family, etc...). However, there's also an option to return ANY type of property but take the other criteria into consideration. Is there a way to dynamically modify the where clause depending on whether a user wants to return all property type?
SELECT a.id, property_id, price, name as section_name, baths, beds
FROM
properties a, subdivision b
WHERE
a.subdivision = b.id and
property_type = $property_type
ORDER by id"