Repository navigation
Expand file tree
/
Copy pathOLDetails.php
More file actions
71 lines (43 loc) · 2.02 KB
/
Copy pathOLDetails.php
File metadata and controls
71 lines (43 loc) · 2.02 KB
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
<?php
session_start();
include('DBconnection.php');
$subjects = '';
$connection = db_connect();
if (!isset($_SESSION["OLExamDetails"])) {
$query1 = 'INSERT INTO studentolexamdetailsmap(StudentKey, Year, IndexNo, Medium) VALUES ('.$_SESSION["StudentKey"].',?,?,?)';
$stmt1 = $connection->stmt_init();
if (!$stmt1->prepare($query1)) {
print "Failed to prepare statement1\n";
} else {
$stmt1->bind_param("sss", $param1, $param2, $param3);
$param1 = $_POST['ol_year'];
$param2 = $_POST['ol_index_no'];
$param3 = $_POST['ol_medium'];
$stmt1->execute();
}
$query1 = 'select * from studentolexamdetailsmap where StudentKey = ' . $_SESSION["StudentKey"];
$result = $connection->query($query1);
$row = $result->fetch_assoc();
$_SESSION["OLExamDetails"] = $row;
} else {
$query1 = 'UPDATE studentolexamdetailsmap SET Year=?,IndexNo=?,Medium=? WHERE StudentKey=' . $_SESSION["StudentKey"];
$stmt1 = $connection->stmt_init();
if (!$stmt1->prepare($query1)) {
print "Failed to prepare update statement1\n";
} else {
$row = $_SESSION["OLExamDetails"];
if ($_POST['ol_year'] != $row['Year'] or $_POST['ol_index_no'] != $row['IndexNo'] or $_POST['ol_medium'] != $row['Medium'] ) {
$stmt1->bind_param("sss", $param1, $param2, $param3);
$param1 = $_POST['ol_year'];
$param2 = $_POST['ol_index_no'];
$param3 = $_POST['ol_medium'];
$stmt1->execute();
echo 'successful';
$query2 = 'select * from studentolexamdetailsmap where StudentKey = ' . $_SESSION["StudentKey"];
$result = $connection->query($query2);
$row2 = $result->fetch_assoc();
$_SESSION["OLExamDetails"] = $row2;
}
}
}
?>