<?php
require_once ('config.php');
require_once('f_logging.php');
$error_message;
$valid = true;



$site_cd = $_REQUEST['site_cd'];
$wko_isp_stp_rowid = $_REQUEST['wko_isp_stp_rowid'];
$wko_isp_wko_mst_wo_no = $_REQUEST['wko_isp_wko_mst_wo_no'];
$mst_rowid = $_REQUEST['mst_rowid'];


$sql_wko_isp = "UPDATE  wko_isp  SET
						wko_isp_wko_mst_wo_no ='".$wko_isp_wko_mst_wo_no."'		
						where 	site_cd = '".$site_cd."'	
						AND		wko_isp_stp_rowid = '".$wko_isp_stp_rowid."'
						AND		mst_rowid = '".$mst_rowid."'";


$stmt_wko_isp = sqlsrv_query( $conn, $sql_wko_isp);

if( !$stmt_wko_isp ) {
	$error_message = "Error insert table (UPDATE Table wko_isp)";
	returnError($error_message);
	die( print_r( sqlsrv_errors(), true));
}
sqlsrv_free_stmt( $stmt_wko_isp);

returnData();


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

    echo json_encode($returnData);
}

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

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

    echo json_encode($returnData);

    

    exit();
}


?>
