Add: maestro_info

This commit is contained in:
2018-07-19 18:27:11 +09:00
parent 54b8bdb3a2
commit 732c085309
8 changed files with 168 additions and 15 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroID = $_POST["maestro_id"];
$info = get_maestro_info($maestroID);
if($info === null) {
set_error_message("마에스트로 계정 정보를 가져올 수 없습니다.");
send_result_fail();
exit;
}
set_data("name", $info["name"]);
set_data("accountType", $info["accountType"]);
set_data("playerCount", $info["playerCount"]);
send_result_success();
exit;
function get_maestro_info($maestroID) {
global $db_conn;
$query = "
SELECT Name, AccountType, PlayerCount
FROM moty_maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $maestroID);
$stmt->execute();
$stmt->bind_result($name, $accountType, $playerCount);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
$info["name"] = $name;
$info["accountType"] = $accountType;
$info["playerCount"] = $playerCount;
return $info;
}
?>