} elseif (!alreadyExistsInRemoteDB($id)) {
            $response["success"] = 2;
            $response["message"] = "Value has been deleted from remote database";
            echo json_encode($response);
            unsetResponseArray();
        }
    } elseif ($existsInDB === 'False' || $existsInDB === 'false') {
        if (alreadyExistsInRemoteDB($id)) {
            // success tag for android application to handle
            $response = array();
            $response["success"] = 5;
            $response["message"] = "Conflicting Primary Key";
            echo json_encode($response);
            unsetResponseArray();
        } else {
            insertIntoRemoteDB($id, $name, $address, $phonenum, $description, $lastmodified);
        }
    } else {
        $response["success"] = 0;
        $response["message"] = "An unexpected error occurred";
        echo json_encode($response);
        unsetResponseArray();
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) missing";
    // echoing JSON response
    echo json_encode($response);
    unsetResponseArray();
}
        } elseif (!alreadyExistsInRemoteDB($id)) {
            $response["success"] = 2;
            $response["message"] = "Value has been deleted from remote database";
            echo json_encode($response);
            unsetResponseArray();
        }
    } elseif ($existsInDB === 'False' || $existsInDB === 'false') {
        if (alreadyExistsInRemoteDB($id)) {
            // success tag for android application to handle
            $response = array();
            $response["success"] = 5;
            $response["message"] = "Conflicting Primary Key";
            echo json_encode($response);
            unsetResponseArray();
        } else {
            insertIntoRemoteDB($id, $firstname, $lastname, $gender, $birthdate, $address, $postalcode, $phonenum, $lastmodified);
        }
    } else {
        $response["success"] = 0;
        $response["message"] = "An unexpected error occurred";
        echo json_encode($response);
        unsetResponseArray();
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) missing";
    // echoing JSON response
    echo json_encode($response);
    unsetResponseArray();
}
        } elseif (!alreadyExistsInRemoteDB($username, $firstname, $lastname)) {
            $response["success"] = 2;
            $response["message"] = "Value has been deleted from remote database";
            echo json_encode($response);
            unsetResponseArray();
        }
    } elseif ($existsInDB === 'False' || $existsInDB === 'false') {
        if (alreadyExistsInRemoteDB($id)) {
            // success tag for android application to handle
            $response = array();
            $response["success"] = 5;
            $response["message"] = "Conflicting Primary Key";
            echo json_encode($response);
            unsetResponseArray();
        } else {
            insertIntoRemoteDB($username, $password, $firstname, $lastname, $phonenum, $privilege, $existsInDB, $lastmodified);
        }
    } else {
        $response["success"] = 0;
        $response["message"] = "An unexpected error occurred";
        echo json_encode($response);
        unsetResponseArray();
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) missing";
    // echoing JSON response
    echo json_encode($response);
    unsetResponseArray();
}