I want to see the penalties updating, but it's only see after you click the return button and wait for one day again that it will show the penalty.

    "select * from borrow
    LEFT JOIN member ON borrow.member_id = member.member_id
    LEFT JOIN borrowdetails ON borrow.borrow_id = borrowdetails.borrow_id
    LEFT JOIN book on borrowdetails.book_id =  book.book_id 
    ORDER BY borrow.borrow_id DESC
")or die(mysqli_error());

    /* ---- This code below ---- */
    $borrowdate = new Datetime($row['due_date']);
    $currentdate = new Datetime();
    $returndate = new Datetime($row['date_return']);         
    $fines = 0;
    if($currentdate > $returndate){
        $days = $borrowdate->diff($returndate ?: $currentdate, true)->days;
        $fines = $days > 0 ? intval(floor($days)) * 15 : 0;
        $fi = $row['borrow_details_id'];
        mysqli_query($dbcon,"update borrowdetails set fines='$fines' where borrow_details_id = '$fi'");
    /* ------------------------- */
    <tr class="del<?php echo $id ?>">
        <td ><?php echo $row['book_title']; ?></td>
        <td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
        <td><?php echo $row['type']; ?></td>
        <td ><?php echo $row['date_borrow']; ?></td> 
        <td><?php echo $row['due_date']; ?> </td>
        <td><?php echo $row['date_return']; ?> </td>
        <td><?php echo "₱ ".$fines; ?></td>
        <td><?php echo $row['borrow_status'];?></td>
        <td > <a rel="tooltip"  title="Return" id="<?php echo $borrow_details_id; ?>"
                                 href="#delete_book<?php echo $borrow_details_id; ?>" data-toggle="modal"   
                                  class="btn btn-success"><i class="icon-check icon-large"></i>Return</a>
            <?php include('modal_return.php'); ?>



Just a thought about line 16 which is if($currentdate > $returndate){
That looks like why you have to wait a day to see a fines result. What if you had used the => or >= so that line would work if today was the returndate?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.