...

View Full Version : if, if, else, if, else, else...error?



thesavior
01-04-2006, 05:06 AM
This is pretty much what i want to do:


if ($username == $adminuser);
{
if ($password == $adminpass);
{
include 'admin/adminstart.php';
}
else
{
echo $loginerror;
}
}
else
{
echo $loginerror;
}

However i don't think this is the easiest way to do so. Im also getting errors. If someone can tell me the easiest way to do the same thing, i would be very happy. Thanks in advance!

*edit added below*
Im thinking maybe something like:

if ($username == $adminuser) and ($password == $adminpass);
{
include 'admin/adminstart.php';
}
else
{
echo $loginerror;
}

but im getting the and statment wrong.

Kurashu
01-04-2006, 05:20 AM
Close. There is a few errors in your code. The most obvious is the semicolon after the if statements, there doesn't need to be one. And your "fixed" code was close, an if statement needs to be completely enclosed in parentheses. You can also use the and keyword of the double ampersand (&&) for this.


if ($username == $adminuser && $password == $adminpass)
{
include 'admin/adminstart.php';
}
else
{
echo $loginerror;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum