<?php
// get these values from your DB.
require_once('config.php');
$error_message;
$valid = true;
				
$sql="Select sys_ver_mobile_ver,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));
	 
}

do 	{
	 while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {	
	 $sys_ver_mobile_update = $row['sys_ver_mobile_update'];
	 $sys_ver_mobile_ver = $row['sys_ver_mobile_ver'];
	
	}
} while ( sqlsrv_next_result($stmt) );

if ($valid) {

	sqlsrv_free_stmt( $stmt);
	sqlsrv_close( $conn);
	returnData($sys_ver_mobile_update,$sys_ver_mobile_ver);	
}

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

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

 
?>