-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditResult.php
More file actions
107 lines (90 loc) · 2.4 KB
/
editResult.php
File metadata and controls
107 lines (90 loc) · 2.4 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
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
<?php
include "link.php";
//stdId and stdName
$idNumber = $_SESSION["idNumber"];
$name = $_SESSION["name"];
$query = "SELECT position FROM position WHERE idNumber='$idNumber'";
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
$position = $row['position'];
$query = "SELECT grade FROM $position WHERE idNumber='$idNumber'";
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
$grade = $row['grade'];
echo '<table class="table table-striped">
<tr>
<td>stdID</td>
<td>Name</td>
<td>Grade</td>
</tr>';
echo '<tr>';
echo '<td>'. $idNumber .'</td>';
echo '<td>'. $name .'</td>';
echo '<td>'. $grade .'</td>';
echo '</tr>';
echo '</table>';
//credit part
$query = "SELECT SUM(C.credit) AS credit
FROM enroll E, course C
WHERE E.stdID='$idNumber'
AND E.courseID = C.courseID
";
$result = $mysqli->query($query);
$row = $result->fetch_assoc();
$credit = $row['credit'];
//time part
$query = "SELECT C.*
FROM enroll E, course C
WHERE E.stdID='$idNumber'
AND E.courseID = C.courseID
";
$result = $mysqli->query($query);
$count = 0;
while($row = $result->fetch_assoc()){
//echo $row['courseTime'];
$courseTime = $row['courseTime'];
$temp = explode("-", $courseTime);
foreach ($temp as $value) {
$count ++;
}
}
echo "<div class = 'alert alert-info' >";
echo "Total credit is " . $credit . "<br>";
echo "Total hour is " . $count . "<br>";
echo "</div>";
$query = "SELECT *
FROM enroll E, course C, professor P
WHERE C.profID = P.idNumber
AND E.courseID=C.courseID
AND E.stdID='$idNumber'";
$result = $mysqli->query($query);
echo '<table class="table table-striped">
<tr>
<td>courseName</td>
<td>teacherName</td>
<td>classroom</td>
<td>capacity</td>
<td>credit</td>
<td>department</td>
<td>obligatory</td>
<td>courseYear</td>
<td>courseTime</td>
<td>courseID</td>
</tr>';
while ($row = $result->fetch_assoc()){
echo "<tr>";
echo "<td>" . $row['courseName'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['classroom'] . "</td>";
echo "<td>" . $row['capacity'] . "</td>";
echo "<td>" . $row['credit'] . "</td>";
echo "<td>" . $row['department'] . "</td>";
if($row['obligatory'])echo "<td>obligatory</td>";
else echo "<td>not obligatory</td>";
echo "<td>" . $row['courseYear'] . "</td>";
echo "<td>" . $row['courseTime'] . "</td>";
echo "<td>" . $row['courseID'] . "</td>";
echo "</tr>";
}
echo '</table>';
?>