
<?php
include_once("conexao.php");
?>
<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <!-- Meta tags Obrigatórias -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>DADOS</title>
  </head>
<body>
<div style='width: 80%; margin-left: auto; margin-right: auto; margin-top: 20px; padding-bottom: 20px;'>    
<form action="#" method="post">
<label>Buscar por nome:</label>
<input type="text" name="nome">
<input type="submit">
</form>
</div>
<table class='table table-bordered' style='width: 80%; margin-left: auto; margin-right: auto;'>
<thead>
<tr>
<th scope='col'>MATR&Iacute;CULA</th>
<!--th scope='col'>SENHA</th-->
<th scope='col'>NOME</th>
<th scope='col'>S&Eacute;RIE/TURMA</th>
<th scope='col'>TURNO</th>
<th scope='col'>LOGIN</th>
</tr>
</thead>
<tbody>
<?php
$pesquisar = $_POST['nome'];
$result_usuario = "SELECT * FROM cftv WHERE nome_aluno LIKE '%$pesquisar%' ";
$resultado_usuario = mysqli_query($conn, $result_usuario);
if(($resultado_usuario) AND ($resultado_usuario->num_rows != 0)){
while($row_usuario = mysqli_fetch_assoc($resultado_usuario)){    
   echo"<tr>";
     echo"<td>".$row_usuario['matricula']."</td>";
      //echo"<td>".$row_usuario['senha']."</td>";
      echo"<td style='text-transform:uppercase;'>".$row_usuario['nome_aluno']."</td>";
       echo"<td style='text-transform:uppercase;'>".$row_usuario['identificador_turma']."</td>";
        echo"<td style='text-transform:uppercase;'>".$row_usuario['turno']."</td>";
        echo"<td style='text-transform:uppercase;'>".$row_usuario['login']."</td>";
        //$data = $row_usuario['data'];
       // $data = strtotime($data);
       // echo"<td>".date('d/m/Y H:i:s', $data)."</td>";
      echo"</tr>";
}
}else{
    echo"<tr>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro</div></td>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro</div></td>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro</div></td>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro</div></td>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro</div></td>";
	echo"</tr>";
}
?>    
 </tbody>
 </table>

    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  </body>
</html>