<?php
require_once ('config.php');

$error_message;
$valid = true;


$site_cd = $_REQUEST['site_cd'];
$wko_isp_datetime3 = $_REQUEST['wko_isp_datetime3'];
$wko_isp_asset_no = $_REQUEST['wko_isp_asset_no'];


$sql = "UPDATE 	wko_isp SET wko_isp_datetime3 = ? WHERE 	wko_isp_asset_no = ? And wko_isp.site_cd = ?";
		
		$params_wko_isp = array($wko_isp_datetime3,$wko_isp_asset_no,$site_cd);					
        $stmt = sqlsrv_query($conn, $sql,$params_wko_isp);

        if (!$stmt)
        {
            $error_message = "Error updating table (wko_isp)";
            returnError($error_message);
            die(print_r(sqlsrv_errors() , true));
        }
		
		
if ($valid)
{
	sqlsrv_free_stmt($stmt);
	sqlsrv_commit($conn);
	sqlsrv_close($conn);

	returnData();
}

function returnData()
{
    $returnData = array(
        'status' => 'SUCCESS',
        'message' => 'Successfully update'
    );

    echo json_encode($returnData);
}

function returnError($error_message)
{
    $json = array();

$returnData = array(
	'status' => 'ERROR',
	'message' => $error_message
);

	echo json_encode($returnData);
    exit();
}
		



?>
