<?php
include('connection.php');

if (isset($_POST['submit'])) {
    $tnx_id = $_POST['tnx_id'];
    $id = $_POST['id'];

    // Prepare the query using a prepared statement
    $updateQuery = "UPDATE panel_usdt_request SET panel_tnxid = ? WHERE id = ?";

    $stmt = mysqli_prepare($conn, $updateQuery);
    mysqli_stmt_bind_param($stmt, "si", $tnx_id, $id);
    mysqli_stmt_execute($stmt);

    // Check if the update was successful and handle the response accordingly
    if (mysqli_stmt_affected_rows($stmt) > 0) {
        header("Location: usdt_request.php?success=Tnx Id Added Successfully!!!");
    } else {
        header("Location: usdt_request.php?error=Failed insertion!!!");
    }

    mysqli_stmt_close($stmt);
} else {
    header("Location: usdt_request.php?error=Failed insertion!!!");
}
?>
