Code Help
Posted: Mon Nov 30, 2009 1:19 pm
Hello all. I'm trying to code the simple php IF statement below but it does not work properly. Basically it always returns the accepted condition. Wondering if there is something wrong with my query or the IF statement itself. It seems the query statement always returns a "1" value but I need to pull the actual data. Basically I need a query to give me the exact data located in a field and then check that result with my If statement.
$status = mysql_query("SELECT status FROM qls3_users WHERE username = '$username';");
if($status="IN") {
header("location: phpinfo.php");
exit();
}else {
header("location: login-failed.php");
exit();
}
Dunno if this is a PHP or MySql issue but any help would be greatly appreciated. Also just in case someone knows the statement above is set to redirect to "phpinfo.php" if accepted. I don't want to redirect to another page, I simply want it to show the current page if accepted and redirect if denied. I am using this to help deny multiple logins to my site and want to include this in the header of every page.
$status = mysql_query("SELECT status FROM qls3_users WHERE username = '$username';");
if($status="IN") {
header("location: phpinfo.php");
exit();
}else {
header("location: login-failed.php");
exit();
}
Dunno if this is a PHP or MySql issue but any help would be greatly appreciated. Also just in case someone knows the statement above is set to redirect to "phpinfo.php" if accepted. I don't want to redirect to another page, I simply want it to show the current page if accepted and redirect if denied. I am using this to help deny multiple logins to my site and want to include this in the header of every page.