<?php
include('../db_conx.php');

// now we will get the link...
$user_view_id = $_GET['userID'];
$deleteID = $_GET['deleteID'];
$sql_delete = "DELETE FROM loan WHERE id = '$deleteID'";
$query_trans_update = $db_conx->query($sql_delete);

$doc_image = $_GET['docID'];

$path = "../../user/loan_id/" . $doc_image;

if (!unlink($path)) {
    echo "you have an error!";
} else {
    echo "success document ";
}

if ($query_trans_update) {

    echo "Success";
    header('location:../../principal/loan_list.php?tradeDelete=true&userID=' . $user_view_id);
} else {
    echo "failed";
}
