-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_view.php
202 lines (158 loc) · 7.42 KB
/
edit_view.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
session_start();
include("connect.php");
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
header("location: login.php");
exit;
}
$showEmpty = false;
$showError = false;
$showSuccess = false;
if(isset($_GET['del'])) {
if($_SESSION['teacherOf'] == "BCA I yr") {
$sql = "DELETE FROM `bca_1yr` WHERE `stu_enrollNo` = '" . $_GET['del'] . "'" ;
$result = mysqli_query($conn, $sql);
if($result) {
$showSuccess = "Data Successfully Deleted";
}
}
elseif($_SESSION['teacherOf'] == "BCA II yr") {
$sql = "DELETE FROM `bca_2yr` WHERE `stu_enrollNo` = '" . $_GET['del'] . "'" ;
$result = mysqli_query($conn, $sql);
if($result) {
$showSuccess = "Data Successfully Deleted";
}
}
if($_SESSION['teacherOf'] == "BCA III yr") {
$sql = "DELETE FROM `bca_3yr` WHERE `stu_enrollNo` = '" . $_GET['del'] . "'" ;
$result = mysqli_query($conn, $sql);
if($result) {
$showSuccess = "Data Successfully Deleted";
}
}
else {
$showError = "Data can't be deleted.";
}
}
?>
<!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">
<link rel="stylesheet" href="Styling/header.css">
<link rel="stylesheet" href="Styling/alertBox.css">
<link rel="stylesheet" href="Styling/form.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Edit | Delete | View</title>
</head>
<body>
<?php include("partials/_header.php"); ?>
<?php
if (isset($_GET['action'])) {
echo
"<div class='success'>
<!-- <span class='closebtn'>×</span> -->
<strong>Success! </strong> Data Updated Successfully for ".$_GET['action']."
</div>";
}
if (isset($_GET['del'])) {
echo
"<div class='success'>
<!-- <span class='closebtn'>×</span> -->
<strong>Success! </strong> Data Deleted Successfully for ".$_GET['del']."
</div>";
}
?>
<div class="insert-container">
<?php
echo "<table>
<tr>
<th colspan='100%' align='center'>".$_SESSION['teacherOf']."</th>
</tr>
<tr>
<th>S.No.</th>
<th>Enroll. Number</th>
<th>Roll Number</th>
<th>Name</th>
<th>Father Name</th>
<th>Mother Name</th>
<th>Session</th>
<th>Mobile Number</th>
<th>Result</th>
<th>Edit</th>
<th>Delete</th>
<th>View</th>
</tr>";
if($_SESSION['teacherOf'] == "BCA I yr") {
$sql = "SELECT * FROM `bca_1yr`";
$result = mysqli_query($conn, $sql);
$sno=0;
while ($row = mysqli_fetch_assoc($result)) {
$sno += 1;
echo "<tr><td>" . $sno . "</td>
<td>" . $row['stu_enrollNo'] . "</td>
<td>" . $row['stu_rollNo'] . "</td>
<td>" . $row['stu_name'] . "</td>
<td>" . $row['stu_faName'] . "</td>
<td>" . $row['stu_moName'] . "</td>
<td>" . $row['stu_sess'] . "</td>
<td>" . $row['stu_mobileNo'] . "</td>
<td>" . $row['Result'] . "</td>
<td class='td_fa'><a href='edit.php?action=edit&eid=" . $row['stu_enrollNo'] ."'><i class='fa fa-pencil' style='font-size:24px;color:black;'></i></a></td>
<td class='td_fa'><a href='edit_view.php?del=" . $row['stu_enrollNo'] ."'><i class='fa fa-times' style='font-size:30px;color:red'></li></a></td>
<td class='td_fa'><a href='view.php?view=" . $row['stu_enrollNo'] ."'><i class='fa fa-eye' style='font-size:24px;color:darkblue'></i></a></td>
</tr>";
}
}
elseif($_SESSION['teacherOf'] == "BCA II yr") {
$sql = "SELECT * FROM `bca_2yr`";
$result = mysqli_query($conn, $sql);
$sno=0;
while ($row = mysqli_fetch_assoc($result)) {
$sno += 1;
echo "<tr><td>" . $sno . "</td>
<td>" . $row['stu_enrollNo'] . "</td>
<td>" . $row['stu_rollNo'] . "</td>
<td>" . $row['stu_name'] . "</td>
<td>" . $row['stu_faName'] . "</td>
<td>" . $row['stu_moName'] . "</td>
<td>" . $row['stu_sess'] . "</td>
<td>" . $row['stu_mobileNo'] . "</td>
<td>" . $row['Result'] . "</td>
<td class='td_fa'><a href='edit.php?action=edit&eid=" . $row['stu_enrollNo'] ."'><i class='fa fa-pencil' style='font-size:24px;color:black;'></i></a></td>
<td class='td_fa'><a href='edit_view.php?del=" . $row['stu_enrollNo'] ."'><i class='fa fa-times' style='font-size:30px;color:red'></li></a></td>
<td class='td_fa'><a href='view.php?view=" . $row['stu_enrollNo'] ."'><i class='fa fa-eye' style='font-size:24px;color:darkblue'></i></a></td>
</tr>";
}
}
elseif($_SESSION['teacherOf'] == "BCA III yr") {
$sql = "SELECT * FROM `bca_3yr`";
$result = mysqli_query($conn, $sql);
$sno=0;
while ($row = mysqli_fetch_assoc($result)) {
$sno += 1;
echo "<tr><td>" . $sno . "</td>
<td>" . $row['stu_enrollNo'] . "</td>
<td>" . $row['stu_rollNo'] . "</td>
<td>" . $row['stu_name'] . "</td>
<td>" . $row['stu_faName'] . "</td>
<td>" . $row['stu_moName'] . "</td>
<td>" . $row['stu_sess'] . "</td>
<td>" . $row['stu_mobileNo'] . "</td>
<td>" . $row['Result'] . "</td>
<td class='td_fa'><a href='edit.php?action=&eid=" . $row['stu_enrollNo'] ."'><i class='fa fa-pencil' style='font-size:24px;color:black;'></i></a></td>
<td class='td_fa'><a href='edit_view.php?del=" . $row['stu_enrollNo'] ."'><i class='fa fa-times' style='font-size:30px;color:red'></li></a></td>
<td class='td_fa'><a href='view.php?view=" . $row['stu_enrollNo'] ."'><i class='fa fa-eye' style='font-size:24px;color:darkblue'></i></a></td>
</tr>";
}
}
else {
echo "0 results";
}
echo "</table>";
?>
</div>
</body>
</html>