Forums

Extra filters on search page? How?

flyboeing 16 Nov, 2011
Hello all,
I have a search form that is working very well. In that form there are several search filters, like a drop down menu with the years, checkboxes and textfields. Now I would like to add some others.

First one:
In my database there is a column called 'aircrafts'. The idea is to create a drop down menu with a list of all the unique aircraft. In that way, nobody has to search for any aircraft that ain't in the database..

Second one:
The second one is a checkbox. This is not really a filter, but I would like to have a checkbox that will only show (if it is checked) the unique registrations of those aircraft. For example, when I am searching for the Boeing 737-800, there will be 10 records, but there are only 5 unique aircrafts of them (5 unique registrations, so each registration is double in the database). If I check that box, I only want to have the 5 unique aircrafts on my page.

I hope this is clear enough. If you have any questions, just ask🙂
I hope someone can help me with this.

Kind regards,
Flyboeing
GreyHead 29 Nov, 2011
Hi flyboeing,

First one: You can generate a drop down in the Header box from a database query. Use SELECT DISTINCT to get a list of the unique aircraft.

Second one:
This is more difficult - do you know what the MySQL query would be to make it work? Possibly adding GROUP BY xxx after the WHERE clause will do it. I don't' remember clearly enough how CC puts the query together withough going and looking at the code.

Bob
flyboeing 29 Nov, 2011
Hello Bob,

I didn't edited this post, sorry for that😶, but the first question I solved. It took me some time to make it work, but it is working now🙂 .

The second one I am thinking how I could do that. I have a checkbox and when it is selected, it has to "say" to the WHERE clause that it only has to show the unique ones. First I thought something like a if-query with SELECT DISTINCT, but I am a total newbie in php/mysql😶.
GreyHead 30 Nov, 2011
Hi flyboeing,

Some experiments with PHPMyAdmin are probably the best way to find out what works. You might explore GROUP BY.

Bob
flyboeing 01 Dec, 2011
Thank you for pointing me in the right direction.
I will take a look at it!
This topic is locked and no more replies can be posted.