I'm a beginner in programming and I'm trying to find something new, in this case, I have two selects fields that tell my values, but I'd like the search to be done even if a field is null
This is the request code
if($_SERVER['REQUEST_METHOD']=='POST'){
$id_categoria = $_POST['id_categoria'];
$id_sub_categoria = $_POST['id_sub_categoria'];
$pagina = 1;
$_SESSION['id_categoria'] = $id_categoria;
$_SESSION['id_sub_categoria'] = $id_sub_categoria;
And in case this is query executed
$result_empresas = ("SELECT * FROM clientes
WHERE categoria_id = '$id_categoria' AND subcategoria_id = '$id_sub_categoria'
OR categoria_id = '$id_categoria' AND subcategoria_id = '$id_sub_categoria' IS NULL
OR subcategoria_id = '$id_sub_categoria'
LIMIT $inicio, $qnt_result_pg");
Thanks to all who can help