<?php
header('Content-Type: application/json');

$app_id = $_POST["AppID"];

include "./../setup/connect_db.php";


$replyJSON = array();
$replyJSON["HowToPlay"] = get_how_to_play($app_id);
if($replyJSON.length === 0) {
	send_error_message($replyJSON, "히스토리 기록 없음");
	$db_conn->close();
	exit;
}

echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();


function get_how_to_play($app_id) {
	global $db_conn;

	$query = "
		SELECT HowToPlay
		FROM app
		WHERE AppID = ?;
	";
	$stmt = $db_conn->prepare($query);
	$stmt->bind_param('i', $app_id);
	$stmt->execute();
	$stmt->bind_result($how_to_play);
	$stmt->fetch();
	$stmt->close();

	return $how_to_play;
}

?>