Fix: DB user column -> player

This commit is contained in:
2018-07-04 21:54:29 +09:00
parent 81860d6800
commit dc87390b8c
26 changed files with 132 additions and 132 deletions
+97
View File
@@ -0,0 +1,97 @@
<?php
header('Content-Type: application/json');
$maestroID = $_POST["maestro_id"];
$playerID = $_POST["player_id"];
/*
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";
deletePlayer($maestroID, $playerID);
$result = hasPlayerID($maestroID, $playerID);
if($result === true) {
send_result_message($replyJSON, "학생 계정 삭제 실패");
exit;
}
$result = hasPlayerRecord($maestroID, $playerID);
if($result === true) {
send_result_message($replyJSON, "학생 플레이 기록 삭제 실패");
exit;
}
$replyJSON["RESULT"] = "success";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
function deletePlayer($maestroID, $playerID) {
global $db_conn;
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND PlayerID = ?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID);
$result = $stmt->execute();
$stmt->close();
// if($result) {
// echo "deleted row count : ".$stmt->affected_rows;
// }
$query = "DELETE FROM moty_player WHERE MaestroID = ? AND PlayerID = ?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID);
$result = $stmt->execute();
$stmt->close();
// if($result) {
// echo "deleted row count : ".$stmt->affected_rows;
// }
}
function hasPlayerID($maestroID, $playerID) {
global $db_conn;
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID);
$stmt->execute();
$stmt->bind_result($playerID);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
if($playerID !== null)
return true;
return false;
}
function hasPlayerRecord($maestroID, $playerID) {
global $db_conn;
$query = "SELECT PlayerID FROM moty_best_record WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID);
$stmt->execute();
$stmt->bind_result($playerID);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
if($playerID !== null)
return true;
return false;
}
?>