echo '<a href="main.php?sidebar=lessons&subject_id=' . $_GET['subject_id'] . '&content=add&lesson_id=' . $_GET['lesson_id'] . '"<h2><i class="fa fa-pencil-square-o"></i> Edit lesson</h2></a>'; ?> </div> <br> <ul> <?php foreach ($bullets as $bullet) { echo '<div class="bullet-li"><h3><i class="fa fa-lightbulb-o paddedicon"></i>' . $bullet->getBullet() . '</h3></div>'; //2) get Text in each bullets $texts = Text::getTextByBullet($bullet->getId()); //3) get Code in each bullets $codes = Code::getCodeBybullet($bullet->getId()); //4) get Photos in each bullets $photos = Photo::getPhotosByBullet($bullet->getId()); // Now i Will make an associative array with date, type of object and object $notes = array(); //2) start whit text if (count($texts) > 0) { foreach ($texts as $text) { $note = new Note($text->getDate(), 'text', $text); array_push($notes, $note); } } //3) then with code if (count($codes) > 0) { foreach ($codes as $code) { $note = new Note($code->getDate(), 'code', $code);