-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstudentContents.php
81 lines (67 loc) · 2.85 KB
/
studentContents.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
<?php
include 'config.php';
session_start();
if (isset($_SESSION['user_name']) && isset($_SESSION['student_id'])) {
$week_id = $_GET['week'];
//week details
$sq = "SELECT * FROM week WHERE week_id= '$week_id' ";
$rlt = mysqli_query($conn, $sq);
$week = mysqli_fetch_array($rlt);
$week_id = $week["week_id"];
$week_title = $week["week_title"];
$week_number = $week["week_number"];
$subject_id = $week["subject_id"];
// subject details
$sql = "SELECT * FROM subject WHERE subject_id= '$subject_id' ";
$result = mysqli_query($conn, $sql);
$subject = mysqli_fetch_array($result);
$subject_id = $subject["subject_id"];
$subject_name = $subject["subject_name"];
?>
<!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 href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="styleOthers.css">
<title>studentContents</title>
</head>
<body>
<div>
<h1 class="fw-bold">
<?php
echo $subject_name; ?> </h1>
<h1 class="fs-2 fw-bold">
<?php
echo "week no. " . $week_number . "<br>" . $week_title; ?> </h1>
</div>
<!-- showing contents -->
<div>
<?php
$query = "SELECT * FROM content WHERE week_id = '$week_id' ORDER BY content_serial_no";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_array($result)) {
$temp = $row["content_id"]; ?>
<div class="section">
<h1 class="font-weight-bold"><?php echo $row["content_title"] ?></h1>
<?php echo "<h4>" . $row["content_name"] . "</h4>" ?>
<?php echo $row["content_link"] ?>
<?php echo "<p>" . $row["content_description"] . "</p>" ?>
<?php echo "<p>" . $row["content_detail_text"] . "</p>" ?>
</div>
<?php }
} else {
echo "<h2>" . $subject_name . "'s week : " . $week_number . " have no content </h2>";
}
?>
</div>
<!-- end content showing-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8" crossorigin="anonymous"></script>
</body>
</html>
<?php } else {
header("Location: studentLogin.php");
} ?>