Have you established a link to your database earlier in your code?
the mysql_query actually takes two variables:
mysql_query($your_query, $link_to_database)
If you leave the second one off php uses the last open connection that you had, so if you haven't made a link you cannot query the database. So in your code before you make a query you need to establish a link:
// link to database and select database to use
$dbhost = "localhost";
$dbuname = "username";
$dbpass = "password";
$db = "db_name";
$link = mysql_connect($dbhost,$dbuname,$dbpass) or die ("Couldn't connect to server. ");
mysql_select_db($db, $link) or die("Couldn't select database.");
//Query compilation
$qstr = "SELECT player1 from members2 where username = [$SESSION_UNAME]";
// Query execution
$result = mysql_query($qstr, $link);
// Query detail specification
$row = mysql_fetch_array($result);
// The player will be accessible as
echo $row['player1'];
I usually put the database connection stuff in and include file so I don't have to edit a bunch of pages in case something changes.
HTH
Buck