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

$error_message;
$valid = true;


$sql = "UPDATE 	wko_isp SET wko_isp_datetime3 = '".$_REQUEST['wko_isp_datetime3']."'

		WHERE 	wko_isp_asset_no = '".$_REQUEST['wko_isp_asset_no']."'
				And wko_isp.site_cd = '".$_REQUEST['site_cd']."'";
				
        $stmt = sqlsrv_query($conn, $sql);

        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();
}
		



?>
