Fix: edit check same player data count

This commit is contained in:
2018-07-05 20:48:21 +09:00
parent 8a4ff2053a
commit a9ccd52ba1
2 changed files with 12 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
<?php
$db_host = "localhost";
$db_user = "jisangs";
$db_passwd = "Fr12nds95";
$db_name = "jisangs";
?>
+4 -4
View File
@@ -18,7 +18,7 @@ if(!is_numeric($enterCode)) {
include "./../setup/connect_db.php";
$result = hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode);
if($result !== null) {
if($result > 0) {
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
// $db_conn->close();
exit;
@@ -39,16 +39,16 @@ $db_conn->close();
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
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->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
$stmt->execute();
$stmt->bind_result($playerID);
$stmt->bind_result($playerCount);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
return $playerID;
return $playerCount;
}
function editPlayer($maestroID, $playerID, $playerName, $enterCode) {