-
Notifications
You must be signed in to change notification settings - Fork 0
/
bookList.php
92 lines (79 loc) · 3.43 KB
/
bookList.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
<?php $title = 'Book Management';?>
<?php include 'includes/headlink.php';?>
<body>
<?php include 'includes/sidebar.php';?>
<?php include 'includes/navbar.php';?>
<div class="main_section">
<div class="">
<!-- <a href="manageBooks.php?activePage=manageBooks" class="btn btn-success mb-2 border-0 rounded-0">Add New Books</a> -->
<div class="mx-auto d-block border col-12 p-4 bg-white m-height200">
<table class="table table-bordered display" id="example" style="table-layout: fixed;">
<h4 class="text-center font-weight-bold">Book List</h4>
<?php
if (isset($_SESSION['alert']))
{
echo "<span class='d-block text-center alert alert-danger ' role='alert'>".$_SESSION['alert']."<button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span>
</button></span>";
}
unset($_SESSION['alert']);
?>
<thead>
<tr>
<th width="7%">ID</th>
<th width="">Book Name</th>
<th width="">Authors</th>
<th width="10%">Quantity</th>
<th width="">ISBN</th>
<th width="">Publisher</th>
<th width="8%">Update</th>
<!-- <th>Status</th> -->
<th width="15%">Change Status</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * from books where active_status = 1";
//showing active books
$row = $conn->query($query);
if ($row->num_rows > 0) {
while ($data = $row->fetch_array()) {
$id = $data['id'];
$book_name = $data['book_name'];
$isbn = $data['isbn'];
$author = $data['author'];
$publisher = $data['publisher'];
$stock = $data['stock'];
$category = $data['category'];
$active_status = $data['active_status'];
if ($isbn == 0) { $isbn = 'NULL'; }
if ($active_status == 0) { $status = 'Inactive';}
else {
$status = 'Active';
}
?>
<tr>
<td><?=$id;?></td>
<td><?=$book_name;?></td>
<td><?=$author;?></td>
<td><?=$stock;?></td>
<td><?=$isbn;?></td>
<td><?=$publisher;?></td>
<td>
<a href="editBooks.php?book_id=<?=$id?>&&activePage=bookList" class="btn btn-success">Edit</a>
</td>
<!-- <td><?=$status?></td> -->
<td>
<a href="action/manageBooksAction.php?status=<?=$active_status?>&&book_id=<?=$id?>" class="btn btn-danger">Change Status</a>
</td>
</tr>
<?php }
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include 'includes/footer_link.php';?>
</body>
<html>