45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
|
|
$maestroID = $_POST["maestro_id"];
|
|
$playerName = $_POST["player_name"];
|
|
/*
|
|
if(!is_numeric($enterCode)) {
|
|
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
|
exit;
|
|
} else if(strlen($enterCode) != 6) {
|
|
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
|
exit;
|
|
}
|
|
*/
|
|
|
|
include "./../setup/connect_db.php";
|
|
|
|
$result = getPlayerCount($maestroID, $playerName);
|
|
if($result === null) {
|
|
send_error_message($replyJSON, "등록된 학생이 없습니다.");
|
|
// $db_conn->close();
|
|
exit;
|
|
}
|
|
|
|
$replyJSON["Count"] = $result;
|
|
$replyJSON["RESULT"] = "ok";
|
|
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
|
$db_conn->close();
|
|
|
|
|
|
function getPlayerCount($maestroID, $playerName) {
|
|
global $db_conn;
|
|
|
|
$query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID = ? AND Name = ?";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param('is', $maestroID, $playerName);
|
|
$stmt->execute();
|
|
$stmt->bind_result($userCount);
|
|
$stmt->fetch();
|
|
$stmt->close();
|
|
|
|
return $userCount;
|
|
}
|
|
|
|
?>
|