I have removed this line from query in login_check
COUNT(user_id) as count,

I found this query was not running, so your login_check must look like this as below

function login_check($email, $password){
    $email = mysql_real_escape_string($email);
    $login_query = mysql_query("SELECT  `user_id` FROM `users` WHERE `email`='$email' AND `password`='".md5($password)."'");
    return (mysql_result($login_query, 0) == 1) ? mysql_result($login_query, 0, 'user_id') : false;

}

Even when I change the code that I have to yours, my login script still shows the message "Unknown column 'user_level' in 'field list' " Shouldn't there be a user_level variable determining whether the user is logged with the integer of either a '1' or a '0'? that's how I have it in the database. I have to users with two different emails..one has the user_level of '1' and the other has a user_level of '0'. How would I implement this into my login script along with my query? I have a feeling once I do that, then my script should work properly and I wouldn't get that message showing after login.

this is strange because your all pages working fine here even it is loading user_level in session also. Only way left is to look at your pc to solve.

How is user_level supposed to be passed in the script if it is not in the form itself? the email and password are passed..how do you tell if the user_level is passed? Sorry if this is a dumb question..

actully what i did was once user login we get user_id, and then it is not to be passed, we are again running second query to fetch user_level

Could you show me an example so I could possibly understand how that works?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.