the reason for this is that variables are not being evaluated in singlequotes. use doublequotes or the . notation, like
'SELECT * FROM ' . $table
after fixing this, I think you still should not rely on user input too much, the $_GET['race'] may or may not contain a valid table name.
usually I'd define every valid name and use the default otherwise, e.g.
switch ($_GET['race']) {
case 'race1':
case 'race2':
case '...':
// more goes here
$table = $_GET['race'];
break;
default:
$table = 'defaulttable';
}