You could save the userid in a session variable which gets by each page and use it in subsequent queries.
As for the original sql query........don't use * if you don't need all the information.
If you just need the email address use:
SELECT emailaddress FROM userid WHERE userid = $user LIMIT 1
(LIMIT 1 does the same as LIMIT 0,1)
If you have a large database, this will speed up the query as it's only retrieving one piece of information from the database.