<?php
// get these values from your DB.
require_once('config.php');
$error_message;
$valid = true;
				
$sql="Select sys_ver_mobile_update from sys_ver (NOLOCK)";

$stmt = sqlsrv_query( $conn, $sql);

if( !$stmt ) {
	 $error_message = "Error selecting (sys_ver) ";
	 returnError($error_message);
	 die( print_r( sqlsrv_errors(), true));
	 
}
$sys_ver_mobile_update;
do 	{
	 while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {	
	 $sys_ver_mobile_update = $row['sys_ver_mobile_update'];
	
	}
} while ( sqlsrv_next_result($stmt) );


if ($valid) {

	
	//echo $sql;
	returnData($sys_ver_mobile_update);	
	sqlsrv_free_stmt( $stmt);
	sqlsrv_close( $conn);	
	
}

function returnData($sys_ver_mobile_update){
	$returnData = array(
	'status' => 'SUCCESS',
	'message' => 'Successfully',
	'sys_ver_mobile_update'=>$sys_ver_mobile_update);
	
	echo json_encode($returnData);	
}

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

 
?>