I m trying to implement filters in php and mysql to search record in database....Filters should be like if among 6 filters only two is selected query will perform "AND" operation for these two and fetch data from database and if three then it will perform "AND" operation for these three filters..... one way to implement is to check for each filter like.
if (isset($_GET['name'] && isset($_GET['city'])) {
// perform AND for these two
} elseif(isset($_GET['name'] && (isset($_GET['age'])) {
// perform AND for these three
}
// and so on ...
But the problem is if i have 6 filters then i have to create 64 combinations for it... I m thinking about that is there any alternative solution exists for it ?