-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
50 lines (49 loc) · 2.12 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
<?php
include_once 'connect.php';
$SQLQuery = 'SELECT * FROM people';
$statement = $connection->prepare($SQLQuery);
$statement->execute();
$people = $statement->fetchAll(PDO::FETCH_OBJ);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>All People</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div class="container mx-auto py-8">
<div class="bg-gray-100 shadow-md rounded w-full max-w-lg mx-auto">
<div class="flex justify-between items-center px-4 py-2 border-b border-gray-300">
<h2 class="text-2xl font-semibold">All People</h2>
<a href="create.php" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full uppercase text-xs">Add new user</a>
</div>
<div class="p-4">
<table class="w-full text-left table-auto rounded shadow bg-white">
<tr class="border-b border-gray-300">
<th class="px-4 py-2">ID</th>
<th class="px-4 py-2">Name</th>
<th class="px-4 py-2">Email</th>
<th class="px-4 py-2">Actions</th>
</tr>
<?php foreach ($people as $person): ?>
<tr class="border-b border-gray-300">
<td class="px-4 py-2"><?= $person->id ?></td>
<td class="px-4 py-2"><?= $person->name ?></td>
<td class="px-4 py-2"><?= $person->email ?></td>
<td class="px-4 py-2">
<a class="text-sm text-blue-500" href="edit.php?id=<?= $person->id ?>">Edit</a>
<a class="text-sm text-red-500" onclick="return confirm('Are you Sure You want to Delete This Entry?')"
href="delete.php?id=<?= $person->id ?>">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</body>
</html>