<?php
ob_start();
session_start();
require_once("../conn/conn.php");
//include('../utility/chksession.php');

$co_id= $_REQUEST['co_id'];

$strSQL = "SELECT * FROM hr_course WHERE co_id='$co_id'";
$objQuery = mysqli_query($con,$strSQL); 
$objResult = mysqli_fetch_array($objQuery);


$del1= $objResult['co_file'];
echo $del1;

$delete1="../file/$del1";
@unlink($delete1);

    $sql = "DELETE FROM hr_course WHERE co_id = '$co_id'";
	$query = mysqli_query($con,$sql);

        if($query){
            ?>
                <script language="JavaScript" type="text/javascript">
                    <!--
                    alert("ลบข้อมูลเรียบร้อย!!");
                    location.href='../admin/data_traning.php';
                    //-->
                </script>
            <?php
        }else{
            
            echo "Error: " . $sql . "<br>" . mysqli_error($con);

        }
        mysqli_close($con);

?>