I would like to search the database for all records according to the "DOCTOR" between two dates DATA_INICIAL
and DATA_FINAL
Without repeating records of the day.
CURRENT RESULTS:
BRUNO BARBOSAS 02/04/2018 12:18 02/04/2018 12:18
BRUNO BARBOSAS 02/04/2018 12:22 02/04/2018 12:22
BRUNO BARBOSAS 09/04/2018 08:26 09/04/2018 08:26
BRUNO BARBOSAS 09/04/2018 08:30 09/04/2018 08:30
I WOULD LIKE TO JUST SHOW:
BRUNO BARBOSAS 02/04/2018 12:18 02/04/2018 12:22
BRUNO BARBOSAS 09/04/2018 08:26 09/04/2018 08:30
CODE:
$nome= $_POST['nome'];
$data_i = $_POST['data_inicio'];
$data_f = $_POST['data_fim'];
$consulta= "SELECT * FROM $tabela
WHERE medico = '$medico'
AND data >= '$data_i'
AND data <= '$data_f' ";
$resultado = mysqli_query($conn, $consulta);
while($rows_registro = mysqli_fetch_array($resultado)){
echo $rows_registro['nome'];
echo $rows_registro['data']; //Aqui tem que vir o PRIMEIRO registro do dia sem repetir
echo $rows_registro['data']; //Aqui tem que vir o ULTIMO registro do dia sem repetir
}
After searching between the two dates I would like to show the first record and the last one for each DAY without repeating as the example above shows how you would like the result.