<?php 	

require_once '../../Server/connection.php';

$valid['success'] = array('success' => false, 'messages' => array());

if($_POST) {	

	$editCurrencyName = addslashes(strtoupper($_POST['editCurrencyName']));
	$editBankName = addslashes(strtoupper($_POST['editBankName']));
	$editAccountName = addslashes(strtoupper($_POST['editAccountName']));
	$editBankAccount = addslashes(strtoupper($_POST['editBankAccount']));
	$editSwiftCode = addslashes($_POST['editSwiftCode']);
	$editBankCode = $_POST['editBankCode'];
	$editBranchCode = $_POST['editBranchCode'];
	$editAmount = $_POST['editAmount'];
	
    $currencyId = $_POST['editCategoriesId'];

	$sql = "UPDATE currency SET currencyName = '$editCurrencyName',bank_name='$editBankName',account_name='$editAccountName',bank_account='$editBankAccount',swiftCode='$editSwiftCode',bank_code='$editBankCode',branch_code='$editBranchCode',amount='$editAmount' WHERE currency_id  = '$currencyId'";
	
	

	if($conn->query($sql) === TRUE){
	 	$valid['success'] = true;
		$valid['messages'] = "Bank Details are Successfully Updated";	
	} else {
	 	$valid['success'] = false;
	 	$valid['messages'] = "Error while updating the Bank Details";
	}
	 
	$conn->close();

	echo json_encode($valid);
 
} // /if $_POST