```php getConnection(); try { $connection->beginTransaction(); // Update claim status $updateQuery = "UPDATE claims SET status = :status WHERE claimId = :claimID"; $updateStmt = $connection->prepare($updateQuery); $updateStmt->bindParam(':status', $status); $updateStmt->bindParam(':claimID', $claimID); $updateStmt->execute(); // Get claim details for notifications $detailsQuery = " SELECT c.*, i.description, i.itemID, u.userId, u.name as ownerName FROM claims c JOIN items i ON c.itemID = i.itemID JOIN users u ON c.ownerUserId = u.userId WHERE c.claimId = :claimID "; $detailsStmt = $connection->prepare($detailsQuery); $detailsStmt->bindParam(':claimID', $claimID); $detailsStmt->execute(); $details = $detailsStmt->fetch(PDO::FETCH_ASSOC); // Update item status based on claim result $itemStatus = $status == 'approved' ? 'returned' : 'available'; $itemQuery = "UPDATE items SET status = :status WHERE itemID = :itemID"; $itemStmt = $connection->prepare($itemQuery); $itemStmt->bindParam(':status', $itemStatus); $itemStmt->bindParam(':itemID', $details['itemID']); $itemStmt->execute(); // Create notification for owner $message = $status == 'approved' ? "Your claim for '{$details['description']}' has been approved! The item will be returned to you." : "Your claim for '{$details['description']}' has been rejected. Reason: $notes"; $notificationQuery = "INSERT INTO notifications (userId, message) VALUES (:userId, :message)"; $notificationStmt = $connection->prepare($notificationQuery); $notificationStmt->bindParam(':userId', $details['userId']); $notificationStmt->bindParam(':message', $message); $notificationStmt->execute(); $connection->commit(); $_SESSION['success'] = "Claim processed successfully!"; } catch (Exception $e) { $connection->rollBack(); $_SESSION['error'] = "Error processing claim: " . $e->getMessage(); } header("Location: verifications.php"); exit(); } else { header("Location: verifications.php"); exit(); } ?> ```