Jump to content

Login page


OriginalSunny

Recommended Posts

I have tried create a login page for an administrator so that if the value in admin is 1 it will let the user go through to the next page but it just doesnt work. The code i have used is:

$sql1 = "SELECT admin FROM Employee
WHERE empUsername='$_POST[empUsername]'";
$result1 = mysql_query($sql1)
or die("Couldn't execute query.");
if ($result1 == 1)
{

....(go through to the next page)
}
else
{
(print error message)
}

No matter what i do it just seems to output the error message. I have stored the value 1 for one of the employees and 0 for the other but it still doesnt work. Is it an error in my code?? (I have also tried to put "" around the 1 highlighted in bold). Please help!
Link to comment
Share on other sites

[!--quoteo(post=366391:date=Apr 19 2006, 01:38 PM:name=OriginalSunny)--][div class=\'quotetop\']QUOTE(OriginalSunny @ Apr 19 2006, 01:38 PM) [snapback]366391[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I have tried create a login page for an administrator so that if the value in admin is 1 it will let the user go through to the next page but it just doesnt work. The code i have used is:

$sql1 = "SELECT admin FROM Employee
WHERE empUsername='$_POST[empUsername]'";
$result1 = mysql_query($sql1)
or die("Couldn't execute query.");
if ($result1 == 1)
{

....(go through to the next page)
}
else
{
(print error message)
}

No matter what i do it just seems to output the error message. I have stored the value 1 for one of the employees and 0 for the other but it still doesnt work. Is it an error in my code?? (I have also tried to put "" around the 1 highlighted in bold). Please help!
[/quote]

try
[code]
$sql1 = "SELECT admin FROM Employee
WHERE empUsername='".$_POST['empUsername']."'";
[/code]

that's single quote, double quote .$_POST['empUsername']. double quoute, single quote, double quote.

Rob
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.