I am developing a search engine, and everything is fine. I am at the stage where the user can do an advance search.
This advance search has 2 combo-boxes and 3 check-boxes. So I started to creating if statements: IF 1st Combobox is not 0 then do this query If 1st Combobox is selexted then do this query and so on and so forth.
So all the combinations. I found that really bad approach and I am looking for a better approach ? For instance can I create a universal query that if a value is Null to not consider that restriction?
For example: Lets say that I am trying to do an advance search with the 1st combobox having a value, and all the others are blank.
SELECT ..... WHERE a = 1 and b = null and c = null and d = null and e = null
So null there because the user didn't select something, and therefore the condition with nulls should not be considered ?