Det ser ud til, at indstilling af en variabel i MySql betragtes som en separat forespørgsel. (fetch*() kan ikke håndtere flere opkald)
så for dem med denne type problemer:
$db->query("SET @rank = 0 ;");
$db->fetchAll("SELECT
@rank := @rank +1 AS rank,
SUM(user_scoring_data.user_points) AS user_points,
league_team.user_id
FROM league_team
RIGHT JOIN user_scoring_data ON league_team.league_team_id = user_scoring_data.league_team_id
WHERE league_id = '$league_id' GROUP BY user_scoring_data.league_team_id
ORDER BY user_points DESC"
);