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

$Cli_id= $_REQUEST['Cli_id'];
//echo $Id_type;



    $strSQL = "SELECT * FROM qc_checklistitem where Cli_id='$Cli_id'";
    $objQuery = mysqli_query($con,$strSQL);  
    $objResult = mysqli_fetch_array($objQuery);
    
    $Item_id=$objResult['Item_id'];
    $Cli_code=$objResult['Cli_code'];
    echo $Item_id.$Cli_code;?></br><?
    
    
    $strSQL1 = "SELECT * FROM qc_resultinout
    where Item_id='$Item_id'
    and Cli_code='$Cli_code' ";
    $objQuery1 = mysqli_query($con,$strSQL1);  
    $objResult1 = mysqli_fetch_array($objQuery1);
    //echo $objResult1['Topic_id'];


    $sql = "DELETE FROM qc_checklistitem WHERE Cli_id = '$Cli_id'";
	$query = mysqli_query($con,$sql);

	
    $sql_sub = "DELETE FROM qc_resultinout WHERE Item_id = '$Item_id'and Cli_code = '$Cli_code'";
	$querysub = mysqli_query($con,$sql_sub);
	
	$sql_sub2 = "DELETE FROM qc_resultinsub WHERE Cli_code = '$Cli_code'";
	$querysub = mysqli_query($con,$sql_sub2);
	
	
	
        if($query){
            ?>
                <script language="JavaScript" type="text/javascript">
                    <!--
                    alert("ลบข้อมูลเรียบร้อย!!");
                    location.href='../admin/data_inouttest.php';
                    //-->
                </script>
            <?php
        }else{
            
            echo "Error: " . $sql . "<br>" . mysqli_error($con);

        }
        mysqli_close($con);

?>