<?php
include "config.php";

if (isset($_POST['updates'])) {
    $updates = json_decode($_POST['updates'], true);
    file_put_contents('debug.txt', print_r($updates, true)); // log updates

    foreach ($updates as $update) {
        $id = mysqli_real_escape_string($con, $update['id']);
        $status = mysqli_real_escape_string($con, $update['status']);
        $sql = "UPDATE bank_accounts SET remarks = '$status' WHERE id = '$id'";
        mysqli_query($con, $sql);
    }

    echo "success";
}
?>