return $data;
}
if ($action == "locationRequest") {
    $tap_id = isset($_REQUEST['tap_id']) ? $_REQUEST['tap_id'] : "";
    $update_query = "update tap set isSendLocation = 1 WHERE tap_id = " . $tap_id;
    $data1 = mysql_query($update_query);
    // Send Notification
    $qry = "select * from tap where tap_id = {$tap_id}";
    $tapDetails = selectForJason($qry);
    $qry = "select user_group.*, user.udid,user.name from user_group left join user on user_group.admin_id = user.user_id where group_id = " . $tapDetails[0]['group_id'];
    $groupAdminDetails = selectForJason($qry);
    $members = str_replace("|", ",", $groupAdminDetails[0]['members_id']);
    $sendNoti = new sendNotification();
    foreach ($members as $member) {
        $qry = "select * from user where user_id = {$member}";
        $userDetails = selectForJason($qry);
        $msg = $groupAdminDetails[0]["name"] . " has request to send your location";
        if ($userDetails[0]['udid'] != "") {
            $sendNoti->sendNotificationByApns($userDetails[0]['udid'], $msg, "locationRequest", $tap_id);
        }
    }
    // end notification
    if ($data1) {
        $arr_result = array(RESULT => SUCCESS, MESSAGE => "request sent successfully", DATA => "");
    } else {
        $arr_result = array(RESULT => FAILED, MESSAGE => "something went wrong", DATA => "");
    }
} elseif ($action == "updateUserLocation") {
    $member_id = isset($_REQUEST['member_id']) ? $_REQUEST['member_id'] : "";
    $tap_id = isset($_REQUEST['tap_id']) ? $_REQUEST['tap_id'] : "";
    $latitude = isset($_REQUEST['latitude']) ? $_REQUEST['latitude'] : "";
        }
        $data[$count] = $row;
        $count++;
    }
    mysql_free_result($results);
    return $data;
}
if ($action == "search" && $members_id != '') {
    //    $query = "SELECT * FROM user_group WHERE members_id LIKE '%|$members_id|%' order by created_date desc";
    $query = "SELECT *, (select count(*) as tot from group_request where group_id = user_group.group_id) as totalNumOfRequest FROM user_group WHERE FIND_IN_SET({$members_id}, replace(members_id,'|',',')) > 0  order by created_date desc";
    $groups = selectForJason($query);
    foreach ($groups as $key => $value) {
        $mem_ids = str_replace("|", ",", $groups[$key]['members_id']);
        $mem_ids = rtrim($mem_ids, ',');
        $select_query = "SELECT * FROM `user` WHERE user_id in ({$mem_ids})";
        $memDetails = selectForJason($select_query);
        $groups[$key]["memdetails"] = $memDetails;
    }
    if ($groups) {
        $arr_result = array(RESULT => SUCCESS, MESSAGE => "Group data", DATA => $groups);
    } else {
        $arr_result = array(RESULT => FAILED, MESSAGE => "No Group Found.", DATA => "");
    }
    //	 	$query = "SELECT * FROM user_group WHERE members_id LIKE '%|$members_id|%'";
    //
    //		$data = mysql_query($query);
    //
    //		$total_group = mysql_num_rows($data);
    //		//$insert_id = 11;
    //
    //		if($total_group > 0 ){