Please help, I'm attempting to setup a form which accepts a username and password, these details are then checked within an MSaccess database. If the details are accepted the user is taken to a welcome page or if they provided the wrong credentials an access denied screen.
However I keep on having problems with the else statement below:
Form input contains two inputs :
user_name
password
The above fields are posted to a script which executes the following:
<?
$odbc = "my_database";
$username = "";
$pass_word = "";
$connection = odbc_connect($odbc,$username,$pass_word);
$query = "select user_name, password from users where user_name='$user_name' and password='$password'";
$result = odbc_do($connection, $query);
while(odbc_fetch_row($result));
If (($user_name == $result) && ($password == $result) && $password != "");
{echo "user $user_name exists<br>";
echo $result;
exit();
} else {
echo "user $user_name doesn't exist<br>";
echo $result;
odbc_close_all();
exit();}
?>
Any help would be appreciated.
Thanks.
SB.