I have a login page and have sessions working so that if a user is in the database, they can login. I want to also add a "user_type" to the session so that I can have regular staff see certain things, and admin's see other things, but I can't seem to pull the information out of the database.

Here is part of what I have.

$query = "select * from users where username='$username' and password='$password' ";
$result = mysql_query($query);
$num = mysql_num_rows($result);


$row = mysql_fetch_array($result);

$_SESSION['user_type'] = $row['user_type'];
$user_type = $_SESSION['user_type'];

if ($num > 0 )
{
        $_SESSION['valid_user'] = $username;
        $valid_user = $_SESSION['valid_user'];
}

Now if I tell it to print $valid_user, it shows the user logged in, but if I try to print $user_type I don't get anything in return. Any ideas as to what I am doing wrong? I have tried a separate query for the mysql_fetch_array, and that didn't seem to work either.

Mike



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to