Guest User

Untitled

a guest
Feb 18th, 2020
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.   $dias = array(
  4.     '2019-10-21',
  5.     '2019-10-22',
  6.     '2019-10-23',
  7.     '2019-10-24'
  8.   );
  9.   foreach ($dias as $dia) {
  10.     //pesquisando tudo de presenca do aluno
  11.     $dia21 = mysqli_query($conn, "SELECT * FROM presenca where idEstudante='$id' and dia='$dia'") or die(mysqli_error($conn));
  12.  
  13.     $horarioEntrada = null;
  14.     $horarioSaida221 = null;
  15.     $horarioTotal = new DateTime();
  16.  
  17.  
  18.  
  19.  
  20.     while ($results = mysqli_fetch_array($dia21)) {
  21.       if ($results['tipo'] == 'Entrada') {
  22.         $horarioEntrada =  DateTime::createFromFormat('H:i :s', $results['horario']);
  23.  
  24.         print_r($horarioEntrada);
  25.       }
  26.       if ($results['tipo'] == 'Saida') {
  27.         $horarioSaida221 = DateTime::createFromFormat('H:i:s', $results['horario']);
  28.         echo ("<br>");
  29.         print_r($horarioSaida221);
  30.       }
  31.       if ($horarioEntrada != null and $horarioSaida221 != null) {
  32.  
  33.         $aiff = $horarioEntrada->diff($horarioSaida221)->format("%h:%i:%s");
  34.         $horarioSaida221 = null;
  35.         $horarioEntrada = null;
  36.         print_r($aiff);
  37.         echo '<br>';
  38.       }
  39.     }
  40.   }
  41. }
RAW Paste Data