Hi all I tried to make a login function for my site using script below, but after I type user name and password, it asked me to type again and again and simply reject it, although I have made sure that the username and password I used to test is in the table for sure. No database connection probelm for sure as well. if(!($PHP_AUTH_USER)): Header("WWW-authenticate: basic realm=Restricted Area"); Header("HTTP/1.0 401 Unauthorized"); echo "<meta http-equiv=\"refresh\" content=\"0;url=failed. php3\">"; exit; else: $connection = mysql_connect("localhost", "username", "password")or die("connection fail"); if (!$connection) {echo "An error occurred in connection.\n"; exit;} mysql_select_db("manageasy", $connection); $user_id=$PHP_AUTH_USER; $password=$PHP_AUTH_PW; $result = mysql_query("SELECT hotel_id,username,password FROM hotels WHERE username = '$user_id' AND password='$password'", $connection); Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself"