Just as another note you can use:

Code:
if (empty(userQueryArray))
That will check for an null value. If you would like an example of a session I can give you a good one. I always set a unique session value when it is registered to show whether they are logged in or not. like this:

Code:
$_SESSION['logged_in'] = true;
Then on each page you can call this:

Code:
if($_SESSION['logged_in'] == false)
{
header("location:login.php"); //redirect to login page
}
else
{
//code to be show if they are logged in
}