prepare("SELECT * FROM raj_media WHERE thema = '$selthema' ORDER BY uploaded_date DESC LIMIT :page,:images_per_page"); // Determine which page the user is on and bind the value into our SQL statement $stmt->bindValue(':page', ((int)$current_page-1)*$media_per_page, PDO::PARAM_INT); // How many images will show on each page $stmt->bindValue(':images_per_page', $media_per_page, PDO::PARAM_INT); $stmt->execute(); $media = $stmt->fetchAll(PDO::FETCH_ASSOC); // Get the total amount of images $stmt = $pdo->query('SELECT COUNT(*) FROM raj_media'); $total_media = $stmt->fetchColumn(); // Set image properties below $media_width = 160; $media_height = 160; ?>