<?php
require_once("../config.php");

header('Content-Type: application/json');

$stmt = $pdo->prepare("SELECT type, amount, date FROM transactions WHERE user_id=? ORDER BY id DESC LIMIT 10");
$stmt->execute([$_GET['user_id']]);

echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));