-
Notifications
You must be signed in to change notification settings - Fork 0
/
emp_view.php
93 lines (67 loc) · 2.28 KB
/
emp_view.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
include 'connect.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Display Employee</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<?php include_once 'nav.php';?>
<div class ="container">
<button class ="btn btn-primary my-5">
<a href = "emp_add.php" class="text-light ">Add Employee</a>
</button>
<button class ="btn btn-primary my-5">
<a href = "emp_select.php" class="text-light ">Select Employee</a>
</button>
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Employee Number</th>
<th scope="col">Employee Name</th>
<th scope="col">Date of Birth</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
<?php
$sql = "Select * FROM `employee`";
$result = mysqli_query($con,$sql);
if($result){
while($row = mysqli_fetch_assoc($result)){
//empno,name,dob and address are column names of the employee table.
$id = $row['id'];
$empid = $row['empno'];
$empname = $row['name'];
$dob = $row['dob'];
$address = $row['address'];
echo '<tr>
<th scope="row">'.$id.'</th>
<th>'.$empid.'</th>
<td>'.$empname.'</td>
<td>'.$dob.'</td>
<td>'.$address.'</td>
<td>
<button class = "btn btn-primary" my-1>
<a href="emp_update.php?updateid='.$id.'" class="text-light">Update</a>
</button>
<button class = "btn btn-danger" my-1>
<a href="emp_delete.phpdelet?eid='.$id.'" class="text-light">Delete</a>
</button>
</td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
</body>
</html>