-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
68 lines (55 loc) · 1.89 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
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seznam klientů</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container my-5">
<h2>Seznam klientů</h2>
<a class="btn btn-primary" href="add.php" role="button">Přidat</a>
<br>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Jméno</th>
<th>Email</th>
<th>Mobil</th>
<th>Adresa</th>
<th>vytvořeno v</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
<?php
require("database.php");
$sql = "SELECT * FROM klienti"; //dotaz, zde se jedná o funkci READ, načtě všecho, co je v databázi
$result = mysqli_query($connection, $sql);
if ($result === false) {
die("invalid query");
}
foreach ($result as $data) {
echo "
<tr>
<td>$data[id]</td>
<td>$data[name]</td>
<td>$data[email]</td>
<td>$data[phone]</td>
<td>$data[address]</td>
<td>$data[created_at]</td>
<td>
<a class='btn btn-primary btn-sm' href='edit.php?id=$data[id]'>Editovat</a>
<a class='btn btn-danger btn-sm' href='delete.php?id=$data[id]'>Smazat</a>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
</body>
</html>