SQL:
"SELECT * FROM produto WHERE ($cliente=null OR cliente LIKE '%".$cliente."%')
AND ($n_cad=NULL
OR n_cad=$n_cad)
AND ($cod=NULL
OR id=$cod)
AND ($dt_inicial=NULL
OR data_emissao >= $dt_inicial)
AND ($dt_final=NULL
OR data_emissao <= $dt_final)
ORDER BY id DESC LIMIT ".$min.",".$max;
The error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=null OR n_cad=) AND (=null OR id=) AND (=null OR data_emissao >= ) AND (2017-02' at line 1