<?php
include("conn.php");

if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
    $result = $conn->query("SELECT * FROM investment_plans WHERE id = $id");

    if ($result->num_rows > 0) {
        $plan = $result->fetch_assoc();
        echo json_encode($plan);
    } else {
        echo json_encode(['error' => 'Plan not found']);
    }
} else {
    echo json_encode(['error' => 'Invalid request']);
}
?>
