-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
75 lines (72 loc) · 3.69 KB
/
home.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
68
69
70
71
72
73
74
75
<?php
session_start();
include('includes/header.php');
?>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-10">
<?php
include('includes/message.php');
?>
<div class="card">
<div class="card-header">
<h4>Employee Data
<a href="index.php" class="btn btn-primary float-end">Add</a>
</h4>
</div>
<div class="card-body">
<table class="table table-striped table-hover table-light">
<thead>
<tr>
<th scope="col">Employee ID</th>
<th scope="col">Name</th>
<th scope="col">Contact</th>
<th scope="col">Email</th>
<th scope="col">Department</th>
<th scope="col">Image</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
include ('includes/dbconnect.php');
$fetch_query = "SELECT * FROM employee";
$result = mysqli_query(mysql: $conn, query: $fetch_query);
if(mysqli_num_rows(result: $result) > 0)
{
foreach($result as $row)
{
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['name'] ?></td>
<td><?php echo $row['phone'] ?></td>
<td><?php echo $row['email'] ?></td>
<td><?php echo $row['department'] ?></td>
<td>
<img src="<?php echo "uploads/" .$row['image'] ?>" width="75" height="75" alt="image">
</td>
<td>
<a href="read.php?id=<?php echo $row['id']; ?>" class="btn btn-secondary">View</a>
<a href="update.php?id=<?php echo $row['id']; ?>" class="btn btn-success">Edit</a>
<form action="code.php" method="POST" class="d-inline">
<input type="hidden" name="image" value="<?php echo $row['image'];?>">
<button class="btn btn-danger" value="<?php echo $row['id'];?>" name="delete">Delete</button>
</form>
<!-- <a href="" class="btn btn-danger"></a> -->
</td>
</tr>
<?php
}
}
else{
echo "No records found";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>