getConnection(); $idquotations = isset($_GET['idquotations']) ? intval($_GET['idquotations']) : null; if (!$idquotations) { echo json_encode(['success' => false, 'message' => 'ID quotation mancante']); exit; } try { // Seleziona le foto per il dato idquotations dalla tabella datadb_photos $stmt = $pdo->prepare("SELECT id, file_path FROM datadb_photos WHERE idquotations = ?"); $stmt->execute([$idquotations]); $photos = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($photos && count($photos) > 0) { $photoPaths = array_map(function ($photo) { return '../photostrf/' . $photo['file_path']; }, $photos); echo json_encode(['success' => true, 'photos' => $photoPaths]); } else { echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']); } } catch (PDOException $e) { echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]); }