<?php
include 'koneksi.php';

if (isset($_GET['no_hp'])) {
    $no_hp = $_GET['no_hp'];
    $result = mysqli_query($koneksi, "SELECT * FROM tabungan WHERE no_handphone = '$no_hp' ORDER BY created_at DESC");

    $output = '<table border="1" cellpadding="5" cellspacing="0" style="width:100%;text-align:left;font-size:14px;">
        <thead>
            <tr>
                <th>Tanggal</th>
                <th>Nominal</th>
            </tr>
        </thead><tbody>';

    while ($row = mysqli_fetch_assoc($result)) {
        $output .= "<tr>
            <td>{$row['created_at']}</td>
            <td>Rp " . number_format($row['tabungan_wajib'], 0, ',', '.') . "</td>
        </tr>";
    }
    $output .= '</tbody></table>';

    echo $output;
}
?>