-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminDataDisplayTable.php
More file actions
59 lines (52 loc) · 1.53 KB
/
AdminDataDisplayTable.php
File metadata and controls
59 lines (52 loc) · 1.53 KB
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="AdminDisplayTableCss.css">
<script>
function redirectToUpdateForm(id) {
// Redirect to the update form with the specific ID
window.location.href = 'AdminUpdateForm.php?id=' + id;
}
</script>
</head>
<body>
<table class="usertableview">
<tr class="tablehead">
<th>Staff ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
<th>Password</th>
<th>Email</th>
</tr>
<?php
include ("AdminconnectDB.php");
$sql = "SELECT * FROM staff_member";
$result = $conn->query($sql);
if(!$result){
die("Invalid query: ".$conn->error);
}
while($row = $result->fetch_assoc()){
$id=$row['id'];
$firstname=$row['first_name'];
$lastname=$row['last_name'];
$username=$row['user_name'];
$password=$row['pass'];
$email=$row['email'];
echo '<tr>
<td>'. $id.'</td>
<td>'. $firstname.'</td>
<td>'. $lastname.'</td>
<td>'. $username.'</td>
<td>'. $password.'</td>
<td>'. $email.'</td>
<td>
<button onclick="redirectToUpdateForm('.$row["id"].')">Update</button>
<button><a href="AdminDelete.php?deleteid='.$id.'" class="delebtn">Delete</a></button>
</td>
</tr>';
}
?>
</table>
</body>
</html>