Files
chocomae/src/web/server/player/registered_player_count.php
T
2018-08-22 17:25:07 +09:00

40 lines
732 B
PHP

<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroID = $_POST["maestro_id"];
$playerCount = getPlayerCount($maestroID);
if($result === null) {
set_error_message("등록된 학생이 없습니다.");
send_result_fail();
exit;
}
set_data("playerCount", $playerCount);
send_result_success();
exit;
function getPlayerCount($maestroID) {
global $db_conn;
$query = "
SELECT COUNT(PlayerID)
FROM player
WHERE MaestroID = ? AND AccountType <> 1
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($playerCount);
$stmt->fetch();
$stmt->close();
return $playerCount;
}
?>