<?php
include('include/headscript.php');
$conn = new mysqli($servername, $username, $password, $database);
$idyogaschool = $_GET['idyogaschool'];

// Recupera le foto dal database
$query = $conn->prepare("SELECT idphotoyogaschool AS id, photofilename, priority FROM photoyogaschool WHERE idyogaschool = ?");
$query->bind_param("i", $idyogaschool);
$query->execute();
$result = $query->get_result();

$photos = [];
while ($row = $result->fetch_assoc()) {
    $photos[] = $row;
}

echo json_encode($photos);
