-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent_issue_book.php
114 lines (105 loc) · 4.35 KB
/
student_issue_book.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<?php
include "./includes/student_nav.inc.php";
include "./includes/config.inc.php";
if (isset($_COOKIE['lms_student'])) {
$studentId = $_COOKIE['lms_student'];
} else {
$message = "You need to login first";
echo "<script>alert(\"$message\")</script>";
echo "<script>window.location.href = '../index.php';</script>";
}
?>
<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">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.min.css" integrity="sha384-T5m5WERuXcjgzF8DAb7tRkByEZQGcpraRTinjpywg37AO96WoYN9+hrhDVoM6CaT" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.css" />
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.js"></script>
<style>
table,
td,
th {
border: 1px solid lightgray;
border-collapse: collapse;
}
</style>
<title>Student Details</title>
</head>
<body>
<div class="container my-3 gap-2" style="display: flex; flex-direction: column; align-items: center;">
<h5 class="text-uppercase" style="align-self: flex-start;">Manage Issue Book</h5>
<table id="example" class="display" cellspacing="0" style="height:10em;font-size: .9em;width:60em;">
<thead>
<tr>
<th></th>
<th>Student Name</th>
<th>Book Name</th>
<th>ISBN</th>
<th>Issued Date</th>
<th>Return Date</th>
<th>Fine (if any)</th>
</tr>
</thead>
<?php
$sql = "select * from `students` where studentId='$studentId'";
$result = mysqli_query($conn, $sql);
if ($result) {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row["name"];
}
$sql_issue = "select * from `issuedbook` where studentId='$studentId'";
$result_issue = mysqli_query($conn, $sql_issue);
if ($result_issue) {
while ($row = mysqli_fetch_assoc($result_issue)) {
$issuedDate = $row["issuedDate"];
$reutrnDate = $row["returnDate"];
$fine = $row["fine"];
$isbn = $row["isbn"];
$sql_book = "select * from `books` where ISBNNumber='$isbn'";
$result_book = mysqli_query($conn, $sql_book);
if ($result_book) {
while ($row = mysqli_fetch_assoc($result_book)) {
$BookName = $row["BookName"];
echo '<tr>
<td></td>
<td>' . $name . '</td>
<td>' . $BookName . '</td>
<td>' . $isbn . '</td>
<td>' . $issuedDate . '</td>
<td>' . $reutrnDate . '</td>
<td>' . $fine . '</td>
</tr>';
}
}
}
} else {
echo "issue";
}
}
?>
</tbody>
</table>
</div>
</body>
<script>
$(document).ready(function() {
var table = $('#example').DataTable({
select: false,
"columnDefs": [{
className: "Name",
"targets": [0],
"visible": false,
"searchable": false
}]
}); //End of create main table
$('#example tbody').on('click', 'tr', function() {
alert(table.row(this).data()[0]);
});
});
</script>
</html>