-
Notifications
You must be signed in to change notification settings - Fork 1
/
Viewdepartment.php
72 lines (64 loc) · 1.67 KB
/
Viewdepartment.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
<?php
include("adformheader.php");
include("dbconnection.php");
if(isset($_GET['delid']))
{
$sql ="DELETE FROM department WHERE departmentid='$_GET[delid]'";
$qsql=mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<script>
Swal.fire({
title: 'Done!',
text: 'department deleted successfully',
type: 'success',
})</script>";
}
}
?>
<div class="container-fluid">
<div class="block-header">
<h2>View department record</h2>
</div>
<div class="card">
<section class="container">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<tbody>
<tr>
<td><strong>Department Name</strong></td>
<td><strong>Department Description</strong></td>
<td><strong>Status</strong></td>
<?php
if(isset($_SESSION['adminid']))
{
?>
<td><strong>Action</strong></td>
<?php
}
?>
</tr>
<?php
$sql ="SELECT * FROM department";
$qsql = mysqli_query($con,$sql);
while($rs = mysqli_fetch_array($qsql))
{
echo "<tr>
<td>$rs[departmentname]</td>
<td> $rs[description]</td>
<td> $rs[status]</td>";
if(isset($_SESSION['adminid']))
{
echo "<td>
<a href='department.php?editid=$rs[departmentid]'>Edit</a> | <a href='viewdepartment.php?delid=$rs[departmentid]'>Delete</a> </td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</section>
</div>
</div>
<?php
include("adformfooter.php");
?>