Fix: delete player info - writing exam record

This commit is contained in:
2019-12-21 22:25:59 +09:00
parent ae7489da8a
commit 3a651313db
3 changed files with 121 additions and 20 deletions
@@ -16,6 +16,13 @@ if($maestro_test_player_id === null) {
delete_maestro_test_player_best_record($maestro_test_player_id);
delete_maestro_test_player_app_highest_record($maestro_test_player_id);
delete_maestro_test_typing_exam_highest_record($maestro_test_player_id);
delete_maestro_test_typing_exam_record($maestro_test_player_id);
delete_maestro_test_license_score_record($maestro_test_player_id);
delete_maestro_test_license_time($maestro_test_player_id);
$replyJSON["PlayerID"] = $maestro_test_player_id;
$replyJSON["RESULT"] = "ok";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
@@ -44,6 +51,8 @@ function get_maestro_test_player_id($maestro_id) {
return $maestro_test_player_id;
}
function delete_maestro_test_player_best_record($player_id) {
global $db_conn;
@@ -55,10 +64,6 @@ function delete_maestro_test_player_best_record($player_id) {
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
// $stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
}
@@ -74,10 +79,71 @@ function delete_maestro_test_player_app_highest_record($player_id) {
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
// $stmt->bind_result($maestro_test_player_id);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
}
function delete_maestro_test_typing_exam_highest_record($player_id) {
global $db_conn;
$query = "
DELETE
FROM typing_exam_highest_record
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
$stmt->fetch();
$stmt->close();
}
function delete_maestro_test_typing_exam_record($player_id) {
global $db_conn;
$query = "
DELETE
FROM typing_exam_record
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
$stmt->fetch();
$stmt->close();
}
function delete_maestro_test_license_score_record($player_id) {
global $db_conn;
$query = "
DELETE
FROM license_score
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
$stmt->fetch();
$stmt->close();
}
function delete_maestro_test_license_time($player_id) {
global $db_conn;
$query = "
DELETE
FROM license_time
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $player_id);
$stmt->execute();
$stmt->fetch();
$stmt->close();
}
+33
View File
@@ -10,6 +10,10 @@ $playerID = $_POST["player_id"];
deleteAppHighestRecord($maestroID, $playerID);
deleteBestRecord($maestroID, $playerID);
deleteTypingExamHighestRecord($maestroID, $playerID);
deleteTypingExamRecord($maestroID, $playerID);
deleteLicenseScore($maestroID, $playerID);
deleteLicenseTime($maestroID, $playerID);
@@ -65,6 +69,35 @@ function deleteBestRecord($maestroID, $playerID) {
$stmt->close();
}
function deleteTypingExamHighestRecord($maestroID, $playerID) {
global $db_conn;
$query = "
DELETE FROM typing_exam_highest_record
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $maestroID, $playerID);
$result = $stmt->execute();
$stmt->close();
}
function deleteTypingExamRecord($maestroID, $playerID) {
global $db_conn;
$query = "
DELETE FROM typing_exam_record
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $maestroID, $playerID);
$result = $stmt->execute();
$stmt->close();
}
function deleteLicenseScore($maestroID, $playerID) {
global $db_conn;