-
Notifications
You must be signed in to change notification settings - Fork 1
/
manage_categories.php
72 lines (53 loc) · 1.74 KB
/
manage_categories.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
<?php
//include header
include_once 'includes/header.php';
//include navbar
include_once 'navigation_bar.php';
//update modal
include_once 'update_category_modal.php';
//delete modal
include_once 'delete_category_modal.php';
$limit = 5;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $limit;
$query = "SELECT * FROM jj_inv_categories ORDER BY cid ASC LIMIT $start_from, $limit";
$result = mysqli_query($conn, $query);
?>
<!-- Display table with pagination -->
<div class="container">
<div class="row">
<div class="col-md-12">
<table class="table table-bordered table-container">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Category</th>
<th scope="col">Status</th>
<th scope="col" colspan="2">Action</th>
</tr>
</thead>
<?php while ($row = mysqli_fetch_assoc($result)) { ?>
<tbody>
<tr>
<th scope="row"><?php echo $row['cid']; ?></th>
<td><?php echo $row['category_name']; ?></td>
<td><a href="#" class="btn btn-success btn-sm">Active</a></td>
<td>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#update-category" data-cid="<?php echo $row['cid']; ?>" data-category_name="<?php echo $row['category_name']; ?>"><span class="fa fa-edit"></span> Edit</button><br>
</td>
<td>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete-category" data-c_id="<?php echo $row['cid']; ?>" >
<span class="fa fa-trash"></span> Delete</button>
</td>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
</div>
</div>
<?php
include_once 'category_pagination.php';
?>