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

$surname = $_REQUEST['surname'];
$mobile  = '+'.trim($_REQUEST['mobile']);

$insertCheckins  = "INSERT INTO ea_checkin (`surname`,`mobile_number`,`date`) ";
$insertCheckins .= " VALUES ('".$surname."','".$mobile."',NOW())";
mysqli_query($dbcon, $insertCheckins);
$checkin_id =  mysqli_insert_id($dbcon);
//$checkin_id = '19';

if(!empty($checkin_id)) {
	$responseArray = array('status' => 'success', 'checkin_id' => $checkin_id);
} else {
	$responseArray = array('status' => 'error', 'message' => 'Insert Failed');
}	

header('Content-Type: application/json; charset=utf-8');
echo json_encode($responseArray);
?>