Repository navigation
Expand file tree
/
Copy pathALDetails.php
More file actions
76 lines (47 loc) · 2.38 KB
/
Copy pathALDetails.php
File metadata and controls
76 lines (47 loc) · 2.38 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
72
73
74
75
76
<?php
session_start();
include('DBconnection.php');
$subjects = '';
$connection = db_connect();
if (!isset($_SESSION["ALExamDetails"])) {
$query1 = 'INSERT INTO studentalexamdetailsmap(StudentKey, Year, IndexNo, Medium,Zscore,EnglishQulification) VALUES ('.$_SESSION["StudentKey"].',?,?,?,?,?)';
$stmt1 = $connection->stmt_init();
if (!$stmt1->prepare($query1)) {
print "Failed to prepare statement1\n";
} else {
$stmt1->bind_param("sssss", $param1, $param2, $param3, $param4, $param5);
$param1 = $_POST['al_year'];
$param2 = $_POST['al_index_no'];
$param3 = $_POST['al_medium'];
$param4 = $_POST['zscore'];
$param5 = $_POST['highestenglish'];
$stmt1->execute();
}
$query1 = 'select * from studentalexamdetailsmap where StudentKey = ' . $_SESSION["StudentKey"];
$result = $connection->query($query1);
$row = $result->fetch_assoc();
$_SESSION["ALExamDetails"] = $row;
} else {
$query1 = 'UPDATE studentalexamdetailsmap SET Year=?,IndexNo=?,Medium=?,Zscore=?,EnglishQulification=? WHERE StudentKey=' . $_SESSION["StudentKey"];
$stmt1 = $connection->stmt_init();
if (!$stmt1->prepare($query1)) {
print "Failed to prepare update statement1\n";
} else {
$row = $_SESSION["ALExamDetails"];
if ($_POST['al_year'] != $row['Year'] or $_POST['al_index_no'] != $row['IndexNo'] or $_POST['al_medium'] != $row['Medium'] or $_POST['zscore'] != $row['Zscore'] or $_POST['highestenglish'] != $row['EnglishQulification']) {
$stmt1->bind_param("sssss", $param1, $param2, $param3, $param4, $param5);
$param1 = $_POST['al_year'];
$param2 = $_POST['al_index_no'];
$param3 = $_POST['al_medium'];
$param4 = $_POST['zscore'];
$param5 = $_POST['highestenglish'];
$stmt1->execute();
echo 'successful';
$query2 = 'select * from studentalexamdetailsmap where StudentKey = ' . $_SESSION["StudentKey"];
$result = $connection->query($query2);
$row2 = $result->fetch_assoc();
$_SESSION["ALExamDetails"] = $row2;
}
}
}
?>