<?php

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

    // now we will get the link...
    $user_view_id = $_GET['userID'];

    $doc_image = $_GET['file_name'];

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

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

    // now we will update the database 
    $sql_kyc = "UPDATE personal_information SET kyc_status = '', kyc_doc = '' WHERE id = '$user_view_id'";
    $query_kyc = $db_conx->query($sql_kyc);

    if($query_kyc){
        echo 'success';
        header('location:../../principal/client_dashboard.php?DeleteKycStatus=true&userID='.$user_view_id);
    }else{
        echo 'failed';
    }

?>