<?php 
// get the data base first
include('db_conx.php');

// $id = $_SESSION['id'];

// getting the customers balance from the database in case there is a reduction and the session havent be restarted.
	// $sql = "SELECT * FROM transfer WHERE ref = ' $id' ";
	// $query = $db_conx->query($sql);
	// $row = $query->fetch_assoc();
	// $amount_bal = $row['avaliable_balance'];

	// getting the values passed from the ajax 
	$name_bank = $db_conx->real_escape_string(trim($_POST['name_bank_edit']));
	$swift_code = $db_conx->real_escape_string(trim($_POST['swift_code_edit']));
	$name_bene = $db_conx->real_escape_string(trim($_POST['name_bene_edit']));
	$account_bene = $db_conx->real_escape_string(trim($_POST['b_acc_no_edit']));
	$trans_amount = $db_conx->real_escape_string(trim($_POST['trans_amount_edit']));
	$description = $db_conx->real_escape_string(trim($_POST['description_edit']));
	$t_time_edit = $db_conx->real_escape_string(trim($_POST['t_time_edit']));
	$ref_edit = $db_conx->real_escape_string(trim($_POST['ref_edit']));


	$sql = "UPDATE transfer SET name_bank = '$name_bank',
					swift_code = '$swift_code',
					b_name = '$name_bene',
					b_acc_no = '$account_bene',
					amount = '$trans_amount',
					t_time = '$t_time_edit',
					description = '$description'
	WHERE ref = '$ref_edit' ";
	$query = $db_conx->query($sql);
	
?>