If you've got an array of team ID values (which I'm guessing is what these Team1 and Team2 columns contain?) and you're simply trying to SELECT all rows where these values appear in either column, note you could make the SQL query a bit simpler using the IN () notation, e.g.:
SELECT col1, col2
FROM basketball
WHERE
Team1 IN (1, 2, 3, 4, 5, ..., 999)
OR Team2 IN (1, 2, 3, 4, 5, ..., 999)
which could be constructed as simply as:
$where = 'Team1 IN (' . implode(',', $array_of_team_IDs) . ") \n";
$where .= 'OR Team2 IN (' . implode(',', $array_of_team_IDs) . ") \n";
Also note that you could simplify the querying even further if you restructured the DB into something similar to:
Games
id
name
location
(more game-specific attributes)
Teams
id
name
(more team-specific attributes)
Game_Scores
game_id (foreign key to Games.id)
team_id (foreign key to Teams.id)
final_score
field_goals
free_throws
(more game- and team-specific attributes)
Thus for a given game, you'd insert two rows into Game_Scores - one per team. Now, querying the DB to find all the games involving a list of team IDs would be something like:
SELECT g.id, g.name, g.location
FROM Games g
WHERE g.id IN (
SELECT gs.game_id
FROM Game_Scores gs
WHERE team_id IN (1, 2, 3, 4, ..., 999)
)