<?php

@session_start();
@ob_start();
$conn = mysql_connect('localhost', 'akhilagya', 'abhinay@2018AB') or die ("connection not found");
	mysql_select_db('laabh') or die ("connection not found");
$bank=$_REQUEST["bank_id"];

		 $sql_viewtmp111="select * from tbl_bank_detail where id = '$bank' and session_login_id = '".$_SESSION['login_id']."'";
				$res_viewtmp111=mysql_query($sql_viewtmp111);
				$rows111=mysql_fetch_assoc($res_viewtmp111);
				
				 $sql_viewtmp222="select * from tbl_account_close_mstr where bank_id = '$bank' and session_login_id = '".$_SESSION['login_id']."' order by id desc limit 1";
				$res_viewtmp222=mysql_query($sql_viewtmp222);
				$rows222=mysql_fetch_assoc($res_viewtmp222);
				if($rows222['closing_amount']!=''){
				 $open_bl = $rows222['closing_amount'];
				 $array[] = $open_bl;
				}else{
				 $open_bl = $rows111['opening_bln'];
				   $array[] = $open_bl;
				 }
				  echo json_encode($array);
		?>