This is probably a really dumb question, but it's been bugging the hell out of me. :nono:
I'm setting up a multisearch option on a site that works fine if I complete each of the parameters.
I have 3 fields to choose from, Country, County and City.
As long as I choose one entry from each I'll get the expected results.
However, I need to be able to have the option to choose ALL from any/all of the drop down lists and return the relevant results.
Currently, the values are being passed by the URL which stops me from using wildcards.
Can anyone shed some light as to how to achieve this?
Thanks in advance.
Usually I use some sentinel value for ALL, like -1
For example when $_GET['country'] is set to -1 I don't include the country in the WHERE clause, automatically selecting all countries. Or, to put it differently, not excluding any countries
it's okay to pass in a value of "all" for a particular option, but when you are construction the query, test the value passed in, and it it's "all" then omit the WHERE condition for that parameter
for example, if the parameters passed in for country/county/city are xx/yyy/all then you would run
WHERE country = 'xx'
AND county = 'yyy'
-- no filter on city