<?php /** * */ if (isset($_SESSION['subject_id'])) { //Subject name $subjectName = Subject::getSubjectById($_SESSION['subject_id']); } ?> <h2><?php echo $subjectName; ?> 's Lessons</h2> <br> <?php //echo $_GET['subject_id'/*. " ee "*/]; $lessonsList = Lesson::getLessonsBySubjectId($_GET['subject_id']); foreach ($lessonsList as $lesson) { //format the date $lessonDate = date("d/m/y", strtotime($lesson->getDate())); echo '<div class="sidebar-link"><a href="main.php?sidebar=lessons&subject_id=' . $lesson->getSubjectId() . '&content=doc&lesson_id=' . $lesson->getId() . '">' . $lessonDate . " - " . $lesson->getTitle() . "</a></div>"; } ?> <br><br> <?php //$_SESSION['class_id'] = $_GET['class_id']; ?> <a href="main.php?sidebar=subject&class_id=<?php
<?php $connection = Database::getConnection(); $query = "SELECT class FROM class WHERE id=" . $_GET['class_id']; $result_obj = $connection->query($query); //I COULD USE A FOR AND IT WOULD BE BETTER //BUT IT DOESN'T WORK AND I HAVE NO TIME TO //FIND THE PROBLEM :) $i = 0; while ($result = $result_obj->fetch_array(MYSQLI_ASSOC)) { $class = $result; $i++; } if (isset($_GET['subject_id'])) { //Subject name $subjectName = Subject::getSubjectById($_GET['subject_id']); } ?> <h2><?php echo $class['class'] . ' / '; ?> <span id="subject-title">Subjects <span id="subject-sub-title"> <?php if (isset($subjectName)) { echo " / " . $subjectName; } ?> </span></span></h2>