0
I would like to know how I can make an appointment for the month chosen along with the name. Like if I choose August it will only come month of August and so on and so forth.
This is the query
public function RetornaAtualizacoesFuncionarios($data,$codusuario){
$WHERE = array();
if( empty( $codusuario ) ) {$WHERE[] = "codusuario = :codusuario";}else{ $WHERE[] = "codusuario != '37'"; }
;
if( empty( $data ) ) $WHERE[] = "DATE_FORMAT(data,'%Y-%m') = :data";
try {
$Query = "SELECT
DISTINCT(usuario),
date_format(data,'%d/%m/%Y %H:%i:%s') as data,
codigo,
nome
FROM funcionarios
WHERE codusuario = '$codusuario'
ORDER BY data DESC ";
if( !empty($WHERE) ) $this->$Query .= ' WHERE '.implode(' AND ', $WHERE );
echo "<pre>"; print_r($_POST);
echo "<pre>"; print_r($Query);exit;
include_once $_SESSION['pmodel'].'/classes/mysqlconnection_class.php';
$p_sql = MysqlConnection::getInstance()->prepare($Query);
$_retorno = array();
if($p_sql->execute()) {
while ($_result = $p_sql->fetch(PDO::FETCH_ASSOC)) {
$_retorno[] = $_result;
}
}
return $_retorno;
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
this is the input
<form class="form" id="exibefuncionarios" method="post" target='_blank' action="gerar">
<fieldset>
<div style="border-radius:5px;padding:10px;">
<table class="tbl_relatorio" cellspacing='0' width='100%' border ='0'>
<tr>
<td class='label_1'>Período:</td>
<td>
<input style="width: 290px;" name='data' type='month'/>
</select>
</td>
</tr>
</table>
</div>
</fieldset>