public function _activityshow() { $Comments = new comments(); $Comments->add($_SESSION["USERID"], $_POST['activityrecive'], $_SESSION["ACTIVITYID"]); $re = $Comments->show($_SESSION["ACTIVITYID"], $_POST['groupactivity']); $i = $_POST['groupactivity']; foreach ($re as $r) { $commentshow .= "<div id='comment-" . $r->CommentsId . "' style='display:none'>\n\t\t\t\t<div id='comment_recive'>\n\t\t\t\t<div id='user_picture'><img src='/upload/avatar_small/" . $r->UserId . "_small.jpg' style='float:left'>\n\t\t\t\t</div>\n\t\t\t\t<div id='comment_text'>\n\t\t\t\t" . htmlspecialchars($r->CommentText) . "\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t</div>"; $i++; $commentshow .= "<script>\$('#comment-" . $r->CommentsId . "').show('slow')</script>"; } $commentshow .= "<script>\$('#groupactivity').val(" . $i . ");</script>"; echo $commentshow; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . 'tz/model/connectDB.php'; class comments extends connectDB { public function show() { $this->createObjectMysqli(); $this->mysqli->query("SET NAMES 'utf8'"); $stmt = $this->mysqli->query("SELECT comments FROM tz2016"); while ($row = $stmt->fetch_assoc()) { require $_SERVER['DOCUMENT_ROOT'] . 'tz/views/showComments.php'; } $this->closeMysqli(); } } $comm = new comments(); $comm->show();