I had spotted the error, but looks like you beat me to it.
If you’re only selecting wpID from that playerRank table, then you’d be better off selecting only that in your query, else you’re grabbing extra amounts of unused data.
$query = 'SELECT * FROM playerRank';
$query = 'SELECT wpID FROM playerRank';
Of course if you have to do stuff with the other data, then just disregard the above.
Also you may wish to add a check to see if the query var is set before placing it in a variable, but rather then doing isset/(if else etc..), you could use a one liner to set a default if it’s not set..
$wp_tagID = (get_query_var('tag_id')) ? get_query_var('tag_id') : 0;
// Sets the variable to 0 if the query var didn't exist..
NOTE: 0 default value was an example, you can default it to what you like.
Just avoids PHP chucking up an error if the query var isn’t set.. and sets a default value when needed..