Issue With My Logic???
Posted: Sun Jul 15, 2007 3:27 pm
Hi All,
I am asking a new question on code that I was questioning yesterday, as my original issue was a syntax one. I am using the code below on a page to write one sentence if the user filling out the form on the previous page has an access level of 1 in my database. Even though I enter the username and password for a record in my db that has AccessLevel of 1, I get my "else" sentence. I thought it my be a problem with the values I am entering in my form but I tried hard coding the username and password into my query and it still did not work. Can anyone tell me if the logic I am using just will not work or if you could think of another issue? In case it matters, the AccessLevel column in my database is a VARCHAR. I tried switching to an INT but that still did not work.
Thanks again in advance for your help.
I am asking a new question on code that I was questioning yesterday, as my original issue was a syntax one. I am using the code below on a page to write one sentence if the user filling out the form on the previous page has an access level of 1 in my database. Even though I enter the username and password for a record in my db that has AccessLevel of 1, I get my "else" sentence. I thought it my be a problem with the values I am entering in my form but I tried hard coding the username and password into my query and it still did not work. Can anyone tell me if the logic I am using just will not work or if you could think of another issue? In case it matters, the AccessLevel column in my database is a VARCHAR. I tried switching to an INT but that still did not work.
Thanks again in advance for your help.
Code: Select all
<?PHP include("connection/connect.php"); ?>
<?PHP
$UserName = $_POST["UserName"];
$Password = $_POST["Password"];
?>
Your entered a username of <b>"<?PHP echo $UserName; ?>"</b> and password of <b>"<?PHP echo $Password; ?>"</b>.
<p> </p>
<p> </p>
<?PHP
$FindUser = "select AccessLevel from tbUser where UserName = '$UserName' and Password = '$Password'";
$FoundUser = mysql_query($FindUser);
if ($FoundUser == "1")
echo "This is what you see if you are Access Level 1";
else
echo "You do not have access to this page.";
?>