-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-students.php
98 lines (93 loc) · 4.47 KB
/
all-students.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
<?php
session_start();
if (!isset($_SESSION['loggedin'])) {
header('Location: index.php');
}
$showAlert = false;
?>
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- Bootstrap CSS -->
<link href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0' crossorigin='anonymous'>
<title>All Students</title>
</head>
<body>
<?php
include 'header.php';
if ($showAlert) {
echo "<div class='alert $alertClass alert-dismissible fade show py-2 mb-0' role='alert'>
<strong >$alertMsg</strong>
<button type='button' class='btn-close pb-2' data-bs-dismiss='alert' aria-label='Close'></button>
</div>";
}
?>
<div class="container my-3">
<a href="home.php" class="btn btn-success mb-3">
<- Home</a>
<div style="margin-top: 0px; margin-inline: 1%;">
<center>
<a href="add-student.php" class="btn btn-primary">Add Student</a>
</center>
<h4 class="mb-3">All Students</h4>
<table id="view_cust" class="table-light table table-striped table-bordered " style="width:100%">
<thead>
<tr>
<th>SN</th>
<th> Name </th>
<th>Class</th>
<th>Roll no</th>
<!-- <th># Books issued</th> -->
<th>Record</th>
<!-- <th style="min-width:150px">Actions</th> -->
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM `all_students`";
include_once 'dbCon.php';
$result = mysqli_query($con, $sql);
$rowNos = mysqli_num_rows($result);
for ($x = 0; $x < $rowNos; $x++) {
$sn = $x + 1;
$row = mysqli_fetch_assoc($result);
$name = $row['name'];
$class = $row['class'];
$roll_no = $row['roll_no'];
$books_pending = $row['books_pending'];
// $remark = $row['remark'];
echo "<tr>
<td>$sn </td>
<td>$name </td>
<td>$class</td>
<td>$roll_no</td>
<td>
<a href='books-record.php?student_class=$class&view_roll_no=$roll_no' class='btn btn-primary'>View</a>
</td>
</tr>";
}
mysqli_close($con);
?>
</tbody>
</table>
<!-- for data table -->
<script src="https://code.jquery.com/jquery-3.5.1.js"> </script>
<script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"> </script>
<script src="https://cdn.datatables.net/1.10.24/js/dataTables.bootstrap5.min.js"> </script>
<link href="https://cdn.datatables.net/1.10.24/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<script>
$(document).ready(function() {
$('#view_cust').DataTable({
"scrollX": true,
"pageLength": 10,
});
});
</script>
</div>
</div>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js' integrity='sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8' crossorigin='anonymous'></script>
</body>
</html>