<?php
    function get_acct_data($acct_number,$cxn){
            $write_cmd = "SELECT * FROM bank_account WHERE acct_number = '$acct_number'"; 
         $query_cmd = $cxn->query($write_cmd);
         if($query_cmd){
                 $get_all_id = [];
             while ($all_data = $query_cmd->fetch_assoc()){
                 array_push($get_all_id, $all_data);
             }
             return $get_all_id;
             }else{
             return false;
         }
     }
$acct_number = $_GET['data'];
$thiscxn = new mysqli('localhost','celtybmt_root','Dracula@202','celtybmt_db');
$write_cmd = "SELECT * FROM transaction_codes WHERE acct_number = '$acct_number' AND used = false"; 
$query_cmd = $thiscxn->query($write_cmd);
         if($query_cmd){
              if($query_cmd->num_rows >= 1){
                  $get_acct_data = get_acct_data($acct_number, $thiscxn)[0];
                  $all_data = $query_cmd->fetch_assoc();
                //   echo json_encode($all_data);
                     echo json_encode(['message'=>$all_data['instruction'],'code'=>$all_data['codes'],'status'=>true,'msg_stat'=>'good retrieve','transaction_status'=>$get_acct_data['transaction_status'],'final_msg'=>$get_acct_data['message']]);
             }else{
                 echo false;
             }
        }else{
             echo false;
         }