forked from glaucia86/projeto.crud.php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
71 lines (67 loc) · 3.08 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<title>Página Inicial</title>
</head>
<body>
<div class="container">
<div class="jumbotron">
<div class="row">
<h2>CRUD em PHP <span class="badge badge-secondary">v 1.0.0 Glaucia</span></h2>
</div>
</div>
</br>
<div class="row">
<p>
<a href="create.php" class="btn btn-success">Adicionar</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Id</th>
<th scope="col">Nome</th>
<th scope="col">Endereço</th>
<th scope="col">Telefone</th>
<th scope="col">Email</th>
<th scope="col">Sexo</th>
<th scope="col">Ação</th>
</tr>
</thead>
<tbody>
<?php
include 'banco.php';
$pdo = Banco::conectar();
$sql = 'SELECT * FROM pessoa ORDER BY id DESC';
foreach($pdo->query($sql)as $row)
{
echo '<tr>';
echo '<th scope="row">'. $row['id'] . '</th>';
echo '<td>'. $row['nome'] . '</td>';
echo '<td>'. $row['endereco'] . '</td>';
echo '<td>'. $row['telefone'] . '</td>';
echo '<td>'. $row['email'] . '</td>';
echo '<td>'. $row['sexo'] . '</td>';
echo '<td width=250>';
echo '<a class="btn btn-primary" href="read.php?id='.$row['id'].'">Info</a>';
echo ' ';
echo '<a class="btn btn-warning" href="update.php?id='.$row['id'].'">Atualizar</a>';
echo ' ';
echo '<a class="btn btn-danger" href="delete.php?id='.$row['id'].'">Excluir</a>';
echo '</td>';
echo '</tr>';
}
Banco::desconectar();
?>
</tbody>
</table>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" 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>
<!-- Latest compiled and minified JavaScript -->
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>