-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathmodules.php
More file actions
39 lines (28 loc) · 1.26 KB
/
modules.php
File metadata and controls
39 lines (28 loc) · 1.26 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
<?php
include("_includes/config.inc");
include("_includes/dbconnect.inc");
include("_includes/functions.inc");
// check logged in
if (isset($_SESSION['id'])) {
echo template("templates/partials/header.php");
echo template("templates/partials/nav.php");
// Build SQL statment that selects a student's modules
$sql = "select * from studentmodules sm, module m where m.modulecode = sm.modulecode and sm.studentid = '" . $_SESSION['id'] ."';";
$result = mysqli_query($conn,$sql);
// prepare page content
$data['content'] .= "<table border='1'>";
$data['content'] .= "<tr><th colspan='5' align='center'>Modules</th></tr>";
$data['content'] .= "<tr><th>Code</th><th>Type</th><th>Level</th></tr>";
// Display the modules within the html table
while($row = mysqli_fetch_array($result)) {
$data['content'] .= "<tr><td> $row[modulecode] </td><td> $row[name] </td>";
$data['content'] .= "<td> $row[level] </td></tr>";
}
$data['content'] .= "</table>";
// render the template
echo template("templates/default.php", $data);
} else {
header("Location: index.php");
}
echo template("templates/partials/footer.php");
?>