Fix: edit check same player data count
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$db_host = "localhost";
|
||||||
|
$db_user = "jisangs";
|
||||||
|
$db_passwd = "Fr12nds95";
|
||||||
|
$db_name = "jisangs";
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -18,7 +18,7 @@ if(!is_numeric($enterCode)) {
|
|||||||
include "./../setup/connect_db.php";
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
$result = hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode);
|
$result = hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode);
|
||||||
if($result !== null) {
|
if($result > 0) {
|
||||||
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
||||||
// $db_conn->close();
|
// $db_conn->close();
|
||||||
exit;
|
exit;
|
||||||
@@ -39,16 +39,16 @@ $db_conn->close();
|
|||||||
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
|
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
|
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
|
$stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($playerID);
|
$stmt->bind_result($playerCount);
|
||||||
// while($stmt->fetch())
|
// while($stmt->fetch())
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
return $playerID;
|
return $playerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
|
function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user