Beispiel #1
0
        echo "The comment is: " . $text . "<br>";
    }
    // end of foreach loop
} else {
    echo "There is not comments in database.";
}
// end of if statement
//reset $commentCount
$commentCount = 0;
echo "<br/><br/><br/><b>************************</b><br>";
//Get comments by user
$commentManager = new CommentManager();
if ($user_logged_in) {
    echo "<br/>=======Retrieve commment by user=====<br/> ";
    echo "user id: " . $user_id;
    $commentsByUser = $commentManager->getCommentByUser($user_id);
    $commentCount = count($commentsByUser);
    if ($commentCount > 0) {
        echo "<br/><br/><b>Comments by " . $user->getFirstName() . " </b><br/>";
        foreach ($commentsByUser as $coms) {
            $id = $coms->getId();
            $text = $coms->getText();
            $rating_id = $coms->getRatingId();
            $created_by = $coms->getCreatedBy();
            echo "comment text: " . $text . "<br/>";
        }
        //end of foreach loop
    } else {
        echo "This user do not have any comments.";
    }
    // end if