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

$site_cd = $_REQUEST['site_cd'];
$RowID = $_REQUEST['RowID'];
 
 
$sql = "DELETE FROM puo_ref WHERE   site_cd = '".$site_cd."' AND RowID = '".$RowID."'";
		
$stmt = sqlsrv_query( $conn, $sql);	
		
if( !$stmt ) {
	$error_message = "Error Delete table (puo_ref)";
	returnError($error_message);
	die( print_r( sqlsrv_errors(), true));
}
 while ( sqlsrv_next_result($stmt));

 
if ($valid) {
	
	sqlsrv_close( $conn);	
	returnData();	
}
 
function returnData(){
	$returnData = array(
	'status' => 'SUCCESS',	
	'message' => 'Delete successfully');

	echo json_encode($returnData);
}

function returnError($error_message){	
	
	$returnData = array(
	'status' => 'ERROR',
	'message' => $error_message);	
	echo json_encode($returnData);
	exit();
}



 
 
?>