Fix: revised php code to maestro search
This commit is contained in:
@@ -1,30 +1,22 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$result = getPlayerCount($maestroID);
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
|
||||
|
||||
$playerCount = getPlayerCount($maestroID);
|
||||
if($result === null) {
|
||||
send_error_message($replyJSON, "등록된 학생이 없습니다.");
|
||||
// $db_conn->close();
|
||||
set_error_message("등록된 학생이 없습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["Count"] = $result;
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
set_data("playerCount", $playerCount);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
function getPlayerCount($maestroID) {
|
||||
@@ -32,7 +24,7 @@ function getPlayerCount($maestroID) {
|
||||
|
||||
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestroID);
|
||||
$stmt->bind_param("i", $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerCount);
|
||||
$stmt->fetch();
|
||||
|
||||
Reference in New Issue
Block a user