Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1.  $pesquisaIdPresenca = "SELECT * FROM presenca where idEstudante='$id' and dia='2019-10-21'";
  2.   $rodarPesquisaPresenca = mysqli_query($conn, $pesquisaIdPresenca) or die(mysqli_error($conn));
  3.  
  4.   $horarioEntrada = null ;
  5.   $horarioSaida221 = null;
  6.   $horarioTotal = new DateTime();
  7.   while ($results = mysqli_fetch_array($rodarPesquisaPresenca)) {
  8.  
  9.     if ($results['tipo'] = 'Entrada') {
  10.  
  11.       $horarioEntrada =  DateTime::createFromFormat('H:i :s', $results['horario']);
  12.      
  13.     }
  14.     if ($results['tipo'] = 'Saida') {
  15.       $horarioSaida21 = DateTime::createFromFormat('H:i:s', $results['horario']);
  16.      
  17.     }
  18.   }
  19.   if($horarioEntrada!== null and $horarioSaida221!== null) {
  20.  
  21.     $aiff = $horarioEntrada->diff($horarioSaida221)->format("%h:%i:%s");
  22.     $horarioSaida221 = null;
  23.     $horarioEntrada = null;
  24.     print_r($aiff);
  25.     echo '<br>';
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement