include 'raj_functions.php';
// Connect to MySQL
$pdo = pdo_connect_mysql();
// Limit the amount of images on each page
$media_per_page = 900;
$current_page = isset($_GET['page']) ? $_GET['page'] : 1;
// MySQL query that selects all the images
$stmt = $pdo->prepare("SELECT * FROM raj_media ORDER BY thema ASC 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 = 320;
$media_height = 320;
?>