I have 3 tables.
users
id | user_email | user_password | user_name
id | name | code | admin
community_id | player_id
$email
SELECT id FROM table users WHERE user_email = '$email' (call this new variable 'A')
SELECT community_id FROM table community_players WHERE player_id = 'A' (call this new variable 'B')
SELECT name FROM table communities WHERE id = 'B'
TRY this in single query using JOIN docs mysql Join
SELECT communities.name
FROM users
join community_players
on community_players.player_id=users.id
join communities
on communities.id=community_players.community_id
WHERE users.user_email = '$email'