-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_student.php
129 lines (89 loc) · 2.99 KB
/
view_student.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
error_reporting(0);
session_start();
if(!isset($_SESSION['username'])) {
header("location:login.php");
} elseif($_SESSION['usertype']=='student') {
header("location: login.php");
}
$host = 'localhost';
$user = 'root';
$password = '';
$db_name = 'lms_project';
$conn = mysqli_connect($host, $user, $password, $db_name);
$sql = "SELECT * FROM user WHERE usertype= 'student'" ;
$result = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<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">
<title>Admin Dashboard</title>
<style type="text/css" >
.table_th {
padding: 15px;
font-size: 22px;
background-color: black;
color: white;
}
.table_td {
padding: 15px;
font-size: 18px;
background-color: lightgray;
}
</style>
<?php
include 'admin_css.php';
include 'admin_sidebar.php';
?>
</head>
<body>
<div class="content">
<center>
<h1> All Student Data </h1>
<br><br>
<?php
if ($_SESSION['message']) {
echo $_SESSION['message'];
}
unset($_SESSION['message']);
?>
<br><br>
<table style="border: 1px solid black;" border="1px" >
<tr>
<th class="table_th" >Username</th>
<th class="table_th" >Email</th>
<th class="table_th" >Phone</th>
<th class="table_th" >Password</th>
<th class="table_th" >Delete</th>
<th class="table_th" >Update</th>
</tr>
<?php
while($info=$result->fetch_assoc()) {
?>
<tr>
<td class="table_td" ><?php echo " {$info['username']} "; ?></td>
<td class="table_td" ><?php echo " {$info['email']} "; ?></td>
<td class="table_td" ><?php echo " {$info['phone']} "; ?></td>
<td class="table_td" ><?php echo " {$info['password']} "; ?></td>
<td class="table_td" >
<?php echo " <a onClick=\"javascript:return confirm('Are you sure you want to delete this record?'); \"
class='btn btn-danger' href='delete.php?student_id={$info['id']}'>Delete</a> "; ?>
</td>
<td class="table_td" >
<?php echo " <a
class='btn btn-primary' href='update_student.php?student_id={$info['id']}'>Update</a> "; ?>
</td>
<!--
onClick=\"javascript:return confirm('Are you sure you want to delete this record?'); \" -->
</tr>
<?php
}
?>
</table>
</center>
</div>
</body>
</html>