-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistar-usuario.php
36 lines (32 loc) · 1.18 KB
/
listar-usuario.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
<h1>Listar usuários</h1>
<?php
$sql = "SELECT * FROM usuarios";
$res = $conn->query($sql);
$qtd = $res->num_rows;
if($qtd > 0){
print "<table class='table table-hover table-striped table-bordered'>";
print "<tr>";
print "<th>#</th>";
print "<th>Nome</th>";
print "<th>E-mail</th>";
print "<th>Ações</th>";
print "<tr>";
while($row = $res->fetch_object()){
print "<tr>";
print "<td>".$row->id."</td>";
print "<td>".$row->nome."</td>";
print "<td>".$row->email."</td>";
print "<td>
<button onclick=\"location.href='?page=editar&id=".$row->id."';\"
class='btn btn-success'>Editar</button>
<button onclick=\"if(confirm('Tem certeza que deseja exluiir?'))
{location.href='?page=salvar&acao=excluir&id=".$row->id."'}else{false;};\"
class='btn btn-danger'>Excluir</button>
</td>";
print "<tr>";
}
print "</table>";
}else{
print "<p class='alert alert-danger'>Não encontrou resultados!</p>";
}
?>