-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
42 lines (36 loc) · 1.29 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
<?php require 'db.php';
$sql = 'SELECT * FROM people';
$statment = $connection->prepare($sql);
$statment->execute();
$people = $statment->fetchAll(PDO::FETCH_OBJ);
?>
<?php require 'header.php'; ?>
<div class="container">
<div class="card mt5">
<div class="card-header">
<h2>ALL people</h2>
</div>
<div class="card-body">
<table class="table table-bordered">
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Action</th>
</tr>
<?php foreach ($people as $person) : ?>
<tr>
<td><?= $person->id; ?></td>
<td><?= $person->name; ?></td>
<td><?= $person->email; ?></td>
<td>
<a href="edit.php?id=<?= $person->id ?>" class="btn btn-info">Edit</a>
<a onclick="return confirm('Are you sure you want to delete this entry?')" href="delete.php?id=<?= $person->id ?>" class='btn btn-danger'>Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
<?php require 'footer.php'; ?>