Crypto News

connect_error) { die("Connection failed: " . $conn->connect_error); } // Number of items to display per page $itemsPerPage = 10; // Get the current page from the query parameter or set it to 1 by default $page = isset($_GET['page']) ? intval($_GET['page']) : 1; // Calculate the starting and ending indexes for the current page $startIndex = ($page - 1) * $itemsPerPage; // Query to retrieve data from the rss_feed_db table $sql = "SELECT * FROM rss_feed_data ORDER BY publication_date DESC LIMIT $startIndex, $itemsPerPage"; $result = $conn->query($sql); if ($result->num_rows > 0) { // Display the retrieved data while ($row = $result->fetch_assoc()) { echo '

' . $row['title'] . '

'; // Display the image as an HTML element echo 'Image
'; echo '

' . $row['description'] . '

'; echo 'Published Date: ' . $row['publication_date'] . '
'; echo 'Creator: ' . $row['creator'] . '
'; echo 'Read More

'; echo '
'; } // Pagination links $sql = "SELECT COUNT(*) AS total FROM rss_feed_data"; $result = $conn->query($sql); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $totalItems = $row['total']; $totalPages = ceil($totalItems / $itemsPerPage); echo ''; } } else { echo 'No records found.'; } // Close the database connection $conn->close(); ?>