You can eliminate the creation of a $query variable and use curly syntax to reference the array in the query string.
mysql_query("SELECT * FROM users WHERE userid = '{$_SESSION['userid']}'");
You don't have to create a variable to run a query, you can just type it directly into the function. Remember from a resource management standpoint, memory has to be allocated for every variable that you create, not creating a variable eliminates that.
The $_SESSION variable can be included directly in the query using curly syntax, as I have done above.
Curly syntax is discussed in further detail here:
http://www.php.net/manual/en/language.types.string.php
The other thing is, unless you're using every field in the `users` table, you shouldn't use the wildcard selector, reference the fields that you are actually going to use. if you're just looking to see if the id exists in the field, then select only the users field. Here again, this just leads back to effective resource management, more resources have to be used to select every field, in contrast to only selecting what you need. Beyond that I don't see a problem with it.
Regards,
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::