real_escape_string($category) . "'"; } if ($tag) { $where[] = "tags LIKE '%" . $conn->real_escape_string($tag) . "%'"; } $where_sql = count($where) ? "WHERE " . implode(" AND ", $where) : ""; $result = $conn->query("SELECT * FROM articles $where_sql ORDER BY created_at DESC LIMIT $offset, $limit"); $total_result = $conn->query("SELECT COUNT(*) as total FROM articles $where_sql")->fetch_assoc(); $total_pages = ceil($total_result['total'] / $limit); // Fetch distinct categories for filter list $category_list = $conn->query("SELECT DISTINCT category FROM articles"); ?> Mari Mari Dive & Lodge, Sepanggar | Blog
fetch_assoc()): ?>

See it to believe it