-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewall.php
86 lines (68 loc) · 2.2 KB
/
viewall.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
<?php
include('include/db.php');
if(isset($_REQUEST['dept'])){
$dept = $_REQUEST['dept'];
$query = "SELECT * FROM students JOIN results USING (reg_no, semester) WHERE dept_name = '$dept' ";
} else {
$query = "SELECT * FROM students JOIN results USING (reg_no, semester) ";
}
$statement = $db->prepare($query);
$statement->execute() or die("Couldn't Connect");
if($statement->execute()) {
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
}
?>
<?php
include('common/header.php');
?>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<?php
include('common/sidebar.php');
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<?php
include('common/page_heading.php');
?>
<!-- /.row -->
<div class="col-lg-12">
<table class="table table-bordered table-striped ">
<thead>
<tr>
<th>#</th>
<th>Reg No.</th>
<th>Department</th>
<th>Semester</th>
<th>GPA</th>
<th>CGPA</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php for($i = 0; $i < count($results); $i++): ?>
<tr>
<th scope="row"><?= $i+1 ?></th>
<td><?= $results[$i]['reg_no'] ?></td>
<td><?= $results[$i]['dept_name'] ?></td>
<td><?= $results[$i]['semester'] ?></td>
<td><?= $results[$i]['gpa'] ?></td>
<td><?= $results[$i]['cgpa'] ?></td>
<td>
<a href="edit.php?reg_no=<?= $results[$i]['reg_no'] ?>"><i name="edit" class="fa fa-pencil btn btn-warning" > Edit</i></a>
<a onclick="return confirmDelete()" href="delete.php?reg_no=<?= $results[$i]['reg_no'] ?>" ><i name="delete" class="fa fa-trash-o btn btn-danger" > Delete</i></a>
</td>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
<!-- footer -->
<?php
include('common/footer.php');
?>