$sort_types = ['type', 'country', 'price'];
$sign_for_query = ['type' => '=', 'price' => '>', 'country' => '='];
$sql = '';
$data = $_POST['filters'];
foreach($sort_types as $type) {
if(array_key_exists($type, $data)) {
$sql[] = '`'.$type . '` ' . $sign_for_query[$type] . ' ' .$data[$type];
}
}
Получается массив с запросами. В SQL всё переводим как-то так
implode(' AND ', $sql)
Update:
$specials = ['price' => 'min({val})'];
foreach($sort_types as $type) {
if(array_key_exists($type, $data)) {
if(array_key_exists($type, $specials)) {
$sql[] = str_replace('{val}', $el, $specials[$el]);
} else {
$sql[] = '`'.$type . '` ' . $sign_for_query[$type] . ' ' .$data[$type];
}
}
}