<?
header('Access-Control-Allow-Origin: *');

//var_dump(json_decode(file_get_contents("php://input")));
$postData = json_decode(file_get_contents("php://input"));

//$mysqli = new mysqli("localhost", "afxtech1_myori", "myori2017", "afxtech1_myori");
include_once("db_connect.php");
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
} 

$query = "UPDATE reports SET status='1' WHERE status = '0' AND officer = '" .$postData->officer. "' AND id = '" .$postData->id. "' ";

if ($mysqli->query($query) === TRUE) {
    echo "Record updated successfully";
    http_response_code(200);
} else {
    echo "Error updating record: " . $mysqli->error;
    http_response_code(401);
}

$mysqli->close();

?>