<?php

include_once'conection.php';


    ini_set('date.timezone','America/Bogota');
    $fecha = date("Y-m-d");
    //$fecha = '2020-10-24';
 
    $sql = $connection->prepare("SELECT * FROM audita WHERE fecha = '$fecha'");
    $sql->execute();
    $rows = $sql->fetchAll(PDO::FETCH_ASSOC); 

   // echo "<pre>"; 
   //      print_r($rows);    
   // echo "<pre>"; 




?>
<table id="tabla_auditoria" class="table table-striped table-bordered">
              <thead>
                <tr>
                  <!-- <th class="d-none">orden</th> -->
                  <th>orden</th>
                  <th>cedula</th>
                  <th>validador</th>
                  <th>nombre</th>
                  <th>cu</th>
                  <th>fecha</th>
                  <th>ip</th>

                </tr>
              </thead>
              <tbody>


                <?php

               

                foreach ($rows as $resul) {

                    $orden = $resul['cons'];
                    $cedula = $resul['cedula'];
                    $validador = $resul['validador'];
                    $fecha_hora = $resul['fecha_hora'];
                    $ip = $resul['ip'];
                    
  $sql2 = $connection->prepare("SELECT * FROM funcionario WHERE cedula_funcionario = '$cedula'");
  $sql2->execute();
  $datos2 = $sql2->fetch(PDO::FETCH_ASSOC);                  
                    
  $nombre =  $datos2['primer_nombre']." ".$datos2['primer_apellido'];         
  $cu = $datos2['cu'];                          
                              echo "<tr>";
                              echo "<td>".$orden."</td>";
                              echo "<td>".$cedula."</td>";
                              echo "<td>".$validador."</td>";
                              echo "<td>".$nombre."</td>";
                              echo "<td>".$cu."</td>";
                              echo "<td>".$fecha_hora."</td>";
                              echo "<td>".$ip."</td>";
                              echo "</tr>";                  

                }
                 ?>
              </tbody>
        </table>
   
 




