<div class="page-title">
    <div>
        <h1><i class="fa fa-money"></i> School Bank Account Details</h1>
    </div>
</div>

<div class="card">
    <div class="row">
        <div class="col-12">
            <div class="table-container table-responsive">
                <table class="custom-table table table-bordered table-striped">
                    <caption class="text-center text-danger font-weight-bold">
                        (!!! PLEASE PAY INTO THE CORRECT BANK ACCOUNT FOR THE CORRECT PURPOSE. !!!)
                    </caption>
                    <thead class="thead-dark text-center">
                        <tr>
                            <th>S/N</th>
                            <th>BANK NAME</th>
                            <th>ACCT. NAME</th>
                            <th>ACCT NO.</th>
                            <th>PURPOSE</th>
                        </tr>
                    </thead>
                    <tbody class="text-center">
                        <?php
                        $query = "SELECT * FROM `account_details`";
                        $run_query = mysqli_query($connection, $query);
                        if (mysqli_num_rows($run_query) > 0) {
                            $i = 1;
                            while ($result = mysqli_fetch_assoc($run_query)) {
                                echo "
                                    <tr>
                                        <td>{$i}</td>
                                        <td>" . htmlspecialchars($result['bank_name']) . "</td>
                                        <td>" . htmlspecialchars($result['account_name']) . "</td>
                                        <td>" . htmlspecialchars($result['account_number']) . "</td>
                                        <td>" . htmlspecialchars($result['account_purpose']) . "</td>
                                    </tr>
                                ";
                                $i++;
                            }
                        } else {
                            echo "<tr><td colspan='5' class='text-center text-danger'>No records found</td></tr>";
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
