<?php



 $sql= "SELECT * FROM tbl_transaction WHERE tx_no = '$refno'";
 $result = mysqli_query($link,$sql);
 if(mysqli_num_rows($result) > 0){
   $row = mysqli_fetch_assoc($result);
 
 
   $type = $row['tx_type'];
   $amount = $row['amount'];
   $account = $row['account'];
   $description = $row['description'];
   $to_accno = $row['to_accno'];                         
   $status = $row['status'];                            
   $date = $row['date'];                                 
   $ref = $row['tx_no'];                                     
  
 }
   if(isset($row['amount'])  && isset($row['status']) ){
               $amount;
               $account;
   }else{

     $amount =  '';
 
     $account =  '';
   }
 
    if(isset($_POST['edit'])){
	
	
      $type =$link->real_escape_string( $_POST['type']);
       $amount =$link->real_escape_string( $_POST['amount']);
      $account =$link->real_escape_string( $_POST['account']);
      $description =$link->real_escape_string( $_POST['description']);
      $to_accno =$link->real_escape_string( $_POST['to_accno']);
      $status =$link->real_escape_string( $_POST['status']);
      $date =$link->real_escape_string( $_POST['date']);
   
      
          
        
      $sql1 = "UPDATE tbl_transaction SET tx_type='$type', amount='$amount', date='$date',comments='$description',  to_accno='$to_accno', account='$account',   status='$status'  WHERE tx_no='$ref'";
      
      if (mysqli_query($link, $sql1)) {
          $msg = "History Details Edited Successfully!";
      } else {
          $msg = "Cannot Edit History Details! ";
      }
      }
    

?>




<?php


$sql= "SELECT * FROM tbl_transaction WHERE tx_no = '$refno'";
$result = mysqli_query($link,$sql);
if(mysqli_num_rows($result) > 0){
  $row = mysqli_fetch_assoc($result);


  $type = $row['tx_type'];
  $amount = $row['amount'];
  $account = $row['account'];
  $description = $row['description'];
  $to_accno = $row['to_accno'];                         
  $status = $row['status'];                            
  $date = $row['date'];                                 
  $ref = $row['tx_no'];                                     
                                          

}
  if(isset($row['amount'])  && isset($row['status']) ){
              $amount;
              $account;
  }else{
   
   
    $amount =  '';

    $account =  '';
  }

  

