'. htmlspecialchars($user['nickname'], ENT_QUOTES) .'\'s Replies
';
$get_replies = $dbc->prepare('SELECT * FROM replies WHERE reply_by_id = ? AND deleted = 0 ORDER BY date_time DESC LIMIT 20');
$get_replies->bind_param('i', $user['user_id']);
} else {
$offset = ($_GET['offset'] * 25);
$dateTime = htmlspecialchars($_GET['dateTime']);
$get_replies = $dbc->prepare('SELECT * FROM replies WHERE reply_by_id = ? AND deleted = 0 AND date_time < ? ORDER BY date_time DESC LIMIT 20 OFFSET ?');
$get_replies->bind_param('isi', $user['user_id'], $dateTime, $offset);
}
$get_replies->execute();
$replies_result = $get_replies->get_result();
if(!$replies_result->num_rows == 0){
while($replies = $replies_result->fetch_array()){
$get_user_post = $dbc->prepare('SELECT users.* FROM users, posts WHERE users.user_id = posts.post_by_id AND posts.id = ? LIMIT 1');
$get_user_post->bind_param('i', $replies['reply_post']);
$get_user_post->execute();
$user_post_result = $get_user_post->get_result();
$user_post = $user_post_result->fetch_assoc();
$get_reply_post = $dbc->prepare('SELECT * FROM posts WHERE id = ? LIMIT 1');
$get_reply_post->bind_param('i', $replies['reply_post']);
$get_reply_post->execute();
$reply_post_result = $get_reply_post->get_result();
$reply_post = $reply_post_result->fetch_assoc();
$get_reply_user = $dbc->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
$get_reply_user->bind_param('i', $replies['reply_by_id']);
$get_reply_user->execute();
$reply_user_result = $get_reply_user->get_result();
$reply_user = $reply_user_result->fetch_assoc();
echo '
';
}
} else {
if(!((isset($_GET['offset']) && is_numeric($_GET['offset'])) && isset($_GET['dateTime']))){
echo '
';
}
}
}Comment on '. htmlspecialchars($user_post['nickname'], ENT_QUOTES) .'\'s Post
'. htmlspecialchars($reply_user['nickname'], ENT_QUOTES) .'
';
if (!empty($replies['reply_image'])){
echo '';
}
echo '
' . (mb_strlen($replies['text']) > 199 ? mb_substr($replies['text'],0,200) . '...' : $replies['text']) . '
';
$yeah_count = $dbc->prepare('SELECT COUNT(yeah_by) FROM yeahs WHERE type = "reply" AND yeah_post = ?');
$yeah_count->bind_param('i', $replies['reply_id']);
$yeah_count->execute();
$result_count = $yeah_count->get_result();
$yeah_amount = $result_count->fetch_assoc();
$nah_count = $dbc->prepare('SELECT COUNT(nah_by) FROM nahs WHERE type = 1 AND nah_post = ?');
$nah_count->bind_param('i', $replies['reply_id']);
$nah_count->execute();
$result_count = $nah_count->get_result();
$nah_amount = $result_count->fetch_assoc();
$yeahs = $yeah_amount['COUNT(yeah_by)'] - $nah_amount['COUNT(nah_by)'];
echo '';
echo '';
echo '
'. $yeahs .'
There are no replies yet.