<?php
include('db_connection.php');

$checkin_id     = $_REQUEST['checkin_id'];
$checkin_status = $_REQUEST['checkin_status'];

if($checkin_status == '1') {
	$updateCheckins  = "UPDATE ea_checkin SET `checkin_status` = '1' WHERE checkin_id  = '".$checkin_id."' LIMIT 1";
} else {
	$updateCheckins  = "UPDATE ea_checkin SET `checkin_status` = '2',`status` = '1' WHERE checkin_id  = '".$checkin_id."' LIMIT 1";
}	

$result          = mysqli_query($dbcon, $updateCheckins);

if($result) {
	$responseArray = array('status' => 'success', 'checkinstatus' => $checkin_status);
} else {
	$responseArray = array('status' => 'error', 'message' => 'Error updating records.');
}	
header('Content-Type: application/json; charset=utf-8');
echo json_encode($responseArray);
?>