<?php
require_once '_shared.php';
require_once './db.php';     // client mysqli connector

$conn = db();
$stmt = $conn->prepare("
    INSERT INTO deposits (userid,amount,orderno,status,created_at,updated_at)
    VALUES (?,?,?,?,NOW(),NOW())
    ON DUPLICATE KEY UPDATE amount = VALUES(amount)
");
$stmt->bind_param(
    'idsi',                // i = int, d = double, s = string, i = int
    $data['userId'],
    $data['amount'],
    $data['orderNo'],
    $data['status']
);
$stmt->execute();
echo 'ok';
