I need to know how I can exclude certain rows if a criteria is not specified.
I am developing a property management website. On this website are 1, 2 & 3 bedroom apartment listings. When a person goes on to the site, they will choose how many bedrooms they are looking for.
When they press the submit button, they will be taken to the appropriate page where all the available bedrooms will show. The only problem with this page is that it shows “all” of the bedrooms, including the ones that are “unavailable”. Is there any way to not show an apartment if it is designated in my database as ”unavailable” ?
Below is the code I inputted on the top of my action page:
<cfquery name="Apt_Results" datasource="BD_Foproperties">
SELECT FOUnitDescription.Location, FOUnitDescription.PropertyName, FOUnitDescription.Available, FOUnitDescription.Amenity, FOUnitDescription.Address, FOUnitDescription.UnitNumber, FOUnitDescription.Bedroom, FOUnitDescription.Bathroom, FOUnitDescription.SquareFootage, FOUnitDescription.Rent
<!--- If Query Begin--->
<cfif bedroom IS NOT "">
AND Bedroom LIKE '%#bedroom#%'
<cfif bathroom IS NOT "">
AND Bathroom LIKE '%#bathroom#%'
<!---If Query End--->
ORDER BY FOUnitDescription.SquareFootage DESC, Rent DESC