Untitled
unknown
plain_text
a year ago
2.5 kB
7
Indexable
Never
<?php $servername = "localhost"; $username = "u663580944_cest"; $password = "x8RRaabc"; $dbname = "u663580944_cest"; // Create connection //$conn = new mysqli($servername, $username, $password, $dbname); $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT matricula, nome, nota1, nota2, nota3 from escolar_alunos"; $result = mysqli_query($conn, $sql); ?> <html> <head> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"> </head> <body> <div class="container"> <div class="row"> <div class="col-2"> </div> <div class="col-8 text-center"> <h1>Lista de Alunos</h1> <p> </p> <a href="/pweb20231/cadastro3.php" class="btn btn-outline-primary btn-lg " role="button" >Cadastrar Aluno</a> <p> </p> <table class="table"> <tr> <th> Ações </td> <th> Matricula </td> <th> Nome </td> <th> Nota 1 </td> <th> Nota 2 </td> <th> Nota 3 </td> </tr> <?php if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { ?> <tr> <td> <a href="excluir.php?matricula=<?php echo $row['matricula'] ?>" onclick="return confirmacao('<?php echo $row['nome'] ?>');"> <i class="bi bi-trash"></i> </a> <a href="editar.php?matricula=<?php echo $row['matricula'] ?>"> <i class="bi bi-pencil-square"></i> </a> </td> <td> <?php echo $row['matricula'] ?> </td> <td> <?php echo $row['nome'] ?> </td> <td> <?php echo $row['nota1'] ?> </td> <td> <?php echo $row['nota2'] ?></td> <td> <?php echo $row['nota3'] ?> </td> </tr> <?php } } ?> </table> <script type="text/javascript"> function confirmacao(nome){ var resposta = confirm("Você tem certeza que deseja excluir " + nome + "?"); if (resposta){ return true; } return false; } </script> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> </body> </html>