<?php
$sql_personal_information = "SELECT * FROM personal_information WHERE id = '$id'";
$query_personal_information = $db_conx->query($sql_personal_information);
$row_personal_information = mysqli_fetch_assoc($query_personal_information);
// ---------- 
$first_name = $row_personal_information['first_name'];
$last_name = $row_personal_information['last_name'];
$name = $first_name . ' ' . $last_name;
$gender = $row_personal_information['gender'];
$date_of_birth = $row_personal_information['date_of_birth'];
$email = $row_personal_information['email'];
$phone_number = $row_personal_information['phone_number'];
$address = $row_personal_information['address'];
$city = $row_personal_information['city'];
$state = $row_personal_information['state'];
$zip_code = $row_personal_information['zip_code'];
$account_type = $row_personal_information['account_type'];
$email_verify = $row_personal_information['email_verify'];
$block = $row_personal_information['block'];
$nation = $row_personal_information['nation'];
$kyc_status = $row_personal_information['kyc_status'];
$kyc_doc = $row_personal_information['kyc_doc'];
$step_transfer = $row_personal_information['step_transfer'];
$p_name = $row_personal_information['p_name'];
$p_amount = $row_personal_information['p_amount'];
$p_date = $row_personal_information['p_date'];
$p_date_2 = $row_personal_information['p_date_2'];
$p_date_3 = $row_personal_information['p_date_3'];
$p_button = $row_personal_information['p_button'];


// ======== getting  for personal identification 
$sql_personal_identification = "SELECT * FROM personal_identification WHERE id = '$id'";
$query_personal_identification = $db_conx->query($sql_personal_identification);
$row_personal_identification = mysqli_fetch_assoc($query_personal_identification);

$i_type = $row_personal_identification['i_type'];
$i_number = $row_personal_identification['i_number'];
$expiry_date = $row_personal_identification['expiry_date'];
$passport = $row_personal_identification['passport'];
$routing = $row_personal_identification['routing'];
$c_name = $row_personal_identification['c_name'];
$c_address = $row_personal_identification['c_address'];
$c_number = $row_personal_identification['c_number'];
$c_exp_date = $row_personal_identification['c_exp_date'];
$c_cvc = $row_personal_identification['c_cvc'];
$c_holder = $row_personal_identification['c_holder'];
$c_status = $row_personal_identification['c_status'];


// getting information from confidential_table 
$sql_confidential_table = "SELECT * FROM confidential_table WHERE id = '$id'";
$query_confidential_table = $db_conx->query($sql_confidential_table);
$row_confidential_table = mysqli_fetch_assoc($query_confidential_table);

$last_login = $row_confidential_table['last_login'];
$ip_address = $row_confidential_table['ip_address'];
$avaliable_balance = $row_confidential_table['avaliable_balance'];
$withheld_fund = $avaliable_balance - 10;
$leger_balance = $avaliable_balance - 10;



$otp_code = $row_confidential_table['otp_code'];

$account_no = $row_confidential_table['account_no'];
$two_fa = $row_confidential_table['two_fa'];
$two_fa_status = $row_confidential_table['two_fa_status'];
$pwrd = $row_confidential_table['pwrd'];
$currency = $row_confidential_table['currency'];
$withdraw_active = $row_confidential_table['withdraw_active'];
$tc_active = $row_confidential_table['tc_active'];
$loan_active = $row_confidential_table['loan_active'];
$lc_active = $row_confidential_table['lc_active'];


$sql_trans = "SELECT * FROM transfer WHERE u_id = '$id' ORDER BY id desc LIMIT 4";
$query_trans = $db_conx->query($sql_trans);
$trans_no = mysqli_num_rows($query_trans);

$sql_trans_loan = "SELECT * FROM loan WHERE user_id = '$id' ORDER BY id desc LIMIT 4";
$query_trans_loan = $db_conx->query($sql_trans_loan);
$trans_no_loan = mysqli_num_rows($query_trans_loan);

$sql_trans_2 = "SELECT * FROM transfer WHERE u_id = '$id' ORDER BY id desc";
$query_trans_2 = $db_conx->query($sql_trans_2);
$trans_no_2 = mysqli_num_rows($query_trans_2);

$sql_trans_3 = "SELECT * FROM deposit_logs WHERE user_id = '$id' ORDER BY id desc";
$query_trans_3 = $db_conx->query($sql_trans_3);
$trans_no_3 = mysqli_num_rows($query_trans_3);

if ($block == '1') {
    header('location:../a/principal/account-blocked.php');
}
