close(); exit; } $maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id); $replyJSON["PlayerID"] = $maestro_test_player_id; $replyJSON["PlayerName"] = $maestro_test_player_name; $replyJSON["RESULT"] = "ok"; echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); $db_conn->close(); exit; function get_maestro_test_player_id($maestro_id) { global $db_conn; $query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; $stmt = $db_conn->prepare($query); $stmt->bind_param('i', $maestro_id); $stmt->execute(); $stmt->bind_result($maestro_test_player_id); // while($stmt->fetch()) { // ; // } $stmt->fetch(); $stmt->close(); return $maestro_test_player_id; } function get_maestro_test_player_name($player_id) { global $db_conn; $query = "SELECT Name FROM moty_player WHERE PlayerID=?"; $stmt = $db_conn->prepare($query); $stmt->bind_param('i', $player_id); $stmt->execute(); $stmt->bind_result($maestro_test_player_name); // while($stmt->fetch()) { // ; // } $stmt->fetch(); $stmt->close(); return $maestro_test_player_name; } ?>