<?php 
include_once '../../config/connect.php';
$select = mysqli_query($link, "SELECT * FROM loan_info") or die (mysqli_error($link));

while($row = mysqli_fetch_array($select))

{

$data_de_pagamento = $row['pay_date'];
$hoje = date("Y-m-d");

if ($data_de_pagamento == $hoje) {
	$insert = mysqli_query($link, "UPDATE notify SET notify = 1") or die (mysqli_error($link));
	$borrower = $row['borrower'];
	$selectin = mysqli_query($link, "SELECT fname, lname FROM borrowers WHERE id = '$borrower'") or die (mysqli_error($link));
	$geth = mysqli_fetch_array($selectin);
?>
<tr>
    <td><?php echo $row['id']; ?></td>
	<td><?php echo $row['baccount']; ?></td>
	<td><?php echo $row['desci']; ?></td>
    <td><?php echo $row['amount']; ?></td>
	<td><?php echo $row['amount_topay']; ?></td>
	<td><?php echo $geth['fname']; ?></td>
	<td><?php echo $row['agent']; ?></td>
	<td><?php echo $row['teller']; ?></td>
	<td><?php echo $row['date_release']; ?></td>
	<td><?php echo $row['pay_date']; ?></td>
</tr>
<?php
}else{
	$insert = mysqli_query($link, "UPDATE notify SET notify = 0") or die (mysqli_error($link));
}



}

?>