Sorry to bother you but I have spent hours browsing the internet for an answer to my question, I have searched Google and even asked on yahoo answers but I cannot find a solution to my problem.
I have a database, and in that database is a column called active and it is default to 0. In PHP I want to check to see if when a person is logging in if there account has a 0 in that column if so I log the user in but if not an error message appears saying their account has been banned. The problem is no matter what the message always appears:
Your account has been banned, if you think this is in error email: admin@website.com.
Here is the part of the code causing the problem:
$active = mysql_query("SELECT active FROM users WHERE username='$username'");
if (mysql_num_rows($active) == 0)
{
session_start();
$_SESSION['username'] = $username;
echo "You've been logged in. <a href='http://techhelpandhowtos.tk'>Home</a>";
}
else
{
echo "<font color=Red>Your account has been banned, if you think this is in error email: admin@website.com</font>";
}
A connection to the database is made earlier in the script so that is not the problem. Any help is appreciated. Please, can anyone find answer.