0
I am developing a Property Classifieds, so I need to filter some fields if the internet user wants, such as: Number of rooms, Number of parking spaces, Number of bathrooms, etc.
I need Query to have IF so I can validate.
Example:
SELECT type, property_type, city, region, neighborhood, price, rooms,
bathrooms, parking, content, img1, urlimovel, logo, url
FROM imoveis where type = '$oquedeseja' AND goal = '$idfinalidade'
AND property_type = '$idtipo' AND region = '$iduf' AND city = '$idcidade'
AND rooms = '$nquartos'
AND Rooms = '$nquartos'
In the above example it would check IF variable $nquarties not empty it would filter through Rooms.
I think it is better to make these conditions in the application, via PHP (in case) would be more pleasant.
– Leonardo
@lvcs I have started this process in PHP but as I need several filters, it is getting very complex. Because validating the conditions directly in the query will be easier and I would only use query to validate everything.
– Gladison Neuza Perosini