close(); exit; } $replyJSON["Count"] = $result; $replyJSON["RESULT"] = "ok"; echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); $db_conn->close(); function getPlayerCount($maestroID, $playerName) { global $db_conn; $query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID = ? AND Name = ?"; $stmt = $db_conn->prepare($query); $stmt->bind_param('is', $maestroID, $playerName); $stmt->execute(); $stmt->bind_result($userCount); $stmt->fetch(); $stmt->close(); return $userCount; } ?>