<?php
// This is the simplest possible update script
// No error handling, no transactions, just a direct update

// Database credentials - replace with your actual credentials
$host = 'localhost';
$username = 'hakadosh_banks9s9';
$password = 'pnHJCwNz7Vwc';
$database = 'hakadosh_newbank23';

// Connect to database
$conn = new mysqli($host, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Get transfer ID from query string
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$status = isset($_GET['status']) ? $_GET['status'] : 'hold';

if (!$id) {
    die("No ID provided");
}

// Show current status
$result = $conn->query("SELECT * FROM wire_transfers WHERE id = $id");
if ($row = $result->fetch_assoc()) {
    echo "<h2>Current Status</h2>";
    echo "<pre>";
    print_r($row);
    echo "</pre>";
} else {
    die("Transfer not found");
}

// Update status
$sql = "UPDATE wire_transfers SET status = '$status' WHERE id = $id";
if ($conn->query($sql) === TRUE) {
    echo "<h2>Status Updated</h2>";
    echo "<p>SQL: $sql</p>";
} else {
    echo "<h2>Update Failed</h2>";
    echo "<p>Error: " . $conn->error . "</p>";
}

// Show updated status
$result = $conn->query("SELECT * FROM wire_transfers WHERE id = $id");
if ($row = $result->fetch_assoc()) {
    echo "<h2>Updated Status</h2>";
    echo "<pre>";
    print_r($row);
    echo "</pre>";
} else {
    echo "<p>Transfer not found after update</p>";
}

// Close connection
$conn->close();
?>
