-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcategory_search.php
87 lines (78 loc) · 2.12 KB
/
category_search.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
<?php
include 'auth/database.php';
$search = $_GET['search'];
$result = mysqli_query($connect, "SELECT * FROM category WHERE category_name like ('%$search%') OR status like ('%$search%') OR id like ('%$search%') ");
$query_results = mysqli_num_rows($result);
?>
<!DOCTYPE html>
<html>
<head>
<title>
<style type="text/css">
.active-status{
background-color: #28a745 !important;
font-size: 14px;
color: white;
padding: 1.5px 5px;
border-radius: 2px;
}
.inactive-status{
background-color: #dc3545 !important;
font-size: 14px;
color: white;
padding: 1.5px 5px;
border-radius: 2px;
}
</style>
</title>
</head>
<body>
<table class='table table-striped'>
<tbody>
<?php
if($query_results > 0)
{
while ($data = mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $data['id']; ?></td>
<td><?php echo $data['category_name']; ?></td>
<?php
if($data['status'] == 'active')
{
?>
<td><span class="active-status bg-success"><?php echo $data['status']; ?></span></td>
<?php
}
else
{
?>
<td><span class="inactive-status bg-danger"><?php echo $data['status']; ?></span></td>
<?php
}
?>
<td>
<div class="row">
<button type="submit" name="edit" class="btn btn-sm btn-primary mr-2 edit_data">Edit</button>
<a href="delete_category.php?id=<?php echo $data['id']; ?>" name="cancel" class="btn btn-sm btn-danger">Delete</a>
</div>
</td>
</tr>
<?php
}
}
else
{
?>
<style> thead{ border: none; display: none; } </style>
<div class='alert alert-danger fade show w-100' role='alert'>
<strong>No Matching Records!!</strong>
</div>
<?php
}
?>
</tbody>
</table>
</body>
</html>