<?php include("include/header.php"); ?>
  <?php
  $data = date("Y-m-d");
  $check = mysqli_query($link, "SELECT * FROM lon_info") or die ("Error" . mysqli_error($link));
  while($dados = mysqli_fetch_array($check)){
      $dt = $dados['pay_date'];
      $id = $dados['id'];
      $valor = $dados['amount_topay'];
      if($dt < $data AND $valor != 0){
          $taxa = $valor*0.02;
          $check = mysqli_query($link, "UPDATE loan_info SET amount_topay = amount_topay + '$taxa' WHERE id = '$id'") or die ("Error" . mysqli_error($link));
          $check = mysqli_query($link, "UPDATE transacoes SET debito = debito + '$taxa',saldo = saldo + '$taxa' WHERE emprestimo = '$id'") or die ("Error" . mysqli_error($link));
      }
  }
  ?>