File "wallet-update.php"

Full Path: /home/quiczmwg/lightspringdigitals.com/__MACOSX/admin/wallet-update.php
File size: 1.42 KB
MIME-type: text/x-php
Charset: utf-8

<?php
@session_start();
require_once ("../_db.php");



 // Perform database query to insert or update wallet data (use prepared statements for security)
 if (isset($_POST['btnSaveUpdate'])) {
    $id = $_POST['id'];
    $account_name = $_POST['account_name'];
    $bank = $_POST['bank'];
    // $name = $_POST['name'];
    $account_number = $_POST['account_number'];
    $rounting_number = $_POST['rounting_number'];
    $swift_code = $_POST['swift_code'];
    $account_type = $_POST['account_type'];
    $address = $_POST['address'];
    
    $updateQuery = "UPDATE wallet SET account_name=?, bank=?, account_number=?, routing_number=?, swift_code=?, account_type=?, address=? WHERE id=?";
    $updateStmt = $conn->prepare($updateQuery);

    if ($updateStmt) {
        $updateStmt->bind_param("sssssssi", $account_name, $bank, $account_number, $routing_number, $swift_code, $account_type, $address, $id);
        $updateStmt->execute();

        if ($updateStmt->error) {
            header('Location: manage-wallet.php?status=error&message=Error in database query: ' . $updateStmt->error);
            exit();
        }

        $updateStmt->close();
        header('Location: manage-wallet.php?status=success&message=Wallet updated successfully');
        exit();
    } else {
        header('Location: manage-wallet.php?status=error&message=Error in database query: ' . $conn->error);
        exit();
    }
}