I'm writing some code to create a login area to my site but i keep having the same respone saying the 'while' loop isn't valid. any ideas why? Im passing the 'salesid' and 'password' variables from a form, heres the code for the handler that isn't working: [code] <?php session_start(); $host="localhost"; $user="c3091018"; $password="******"; $dbname="c3091018"; $tablename="employee"; $link=mysql_connect ($host, $user, $password); $query = "SELECT * FROM employee WHERE id = '$salesid' AND password = '$password'"; $result=mysql_db_query ($dbname, $query, $link); ?> <HTML> <HEAD> <TITLE>Sales Login Handler</TITLE> </HEAD> <BODY> </BODY> <?php $password="0"; while ($row=mysql_fetch_array($result)) { $password=$row['password']; } mysql_close($link); if ($password==$password) { $status='loggedin'; print " $row[forename]Go To The Car database,<a href=\"employeedisplaycars.php\">Enter"; } else { $status='invalid'; print "not logged in, invalid user information"; } ?> </HTML> [/code]