latest reviews
prepare('SELECT
reviews.id AS id,
reviews.rating AS rating,
reviews.review AS review,
mods.name AS mod_name,
mods.slug AS mod_slug,
users.username AS user,
users.id AS user_id
FROM reviews
JOIN (
SELECT mods.id AS id, mods.is_removed AS is_removed, mods.name AS name, mods.slug AS slug FROM mods
JOIN users ON users.id = mods.user AND users.is_verified = 1 AND users.is_deleted = 0 AND users.is_suspended = 0
) AS mods ON mods.id = reviews.mod
JOIN users ON users.id = reviews.user
WHERE mods.is_removed = 0
AND users.is_suspended = 0
AND users.is_deleted = 0
AND users.is_verified = 1
ORDER BY reviews.id DESC
LIMIT ?;');
if (!$statement) {
echo "An unexpected error occurred while fetching reviews.
";
} else {
$shownReviews = PAGE_REVIEWS;
$statement->bind_param('i', $shownReviews);
$statement->execute();
$result = $statement->get_result();
if (!$result) {
echo "An unexpected error occurred while fetching reviews.
";
$statement->close();
} else {
$reviewsPresent = false;
while ($review = $result->fetch_assoc()) {
$reviewsPresent = true;
echo '' . str_replace(["\r\n", "\n", "\r"], '
', htmlspecialchars($review['review'])) . '
';
}
if (!$reviewsPresent) {
echo 'No reviews.
';
}
$statement->close();
}
}
?>