Hello, I would like your help, I am creating a form with php and mysql, in this form it has the request screen, type has the fields to be filled with month
and name, in the mount has the month and year e in the name the person types the name or the number of the card.
But here comes the problem that I am facing, when the person enters the month comes the month that she requested, but when she does not type all the data comes from every month, until then it is right because I want it to come like this, but I want the field name to be like this too, when you enter the name, just come the name and when you do not enter everything will have you help me.
Here is the part of Query
. $datcadastro
is the date that is right but the $nomfuncionario
only returns when typing, I want that when I do not enter anything everything will come and when typing the name just come the name entered.
publicfunctionRetornaRelatorios($datcadastro,$nomfuncionario){if(!empty($datcadastro)&&!empty($nomfuncionario)){$WHERE="WHERE DATE_FORMAT(a.datcadastro,'%Y-%m') = '$datcadastro' AND (a.nomfuncionario) = '$nomfuncionario' ";
}else{
$WHERE = "";
}
$this->sql = "SELECT
date_format(a.datcadastro,'%d/%m/%Y %H:%i:%s') as datcadastro,
a.beneficiario,
a.intercambio,
a.procedimento,
date_format(a.datprocedimento,'%d/%m/%Y') as datprocedimento,
a.numguia,
a.retrospectivo,
a.presencial,
a.nomfuncionario,
a.audmedico,
a.hospital
FROM opme.auditoria a
$WHERE
;";
}