this is my checklogin in database function
function CheckLoginInDB($username,$password)
{
if(!$this->DBLogin())
{
$this->HandleError("Database login failed!");
return false;
}
$username = $this->SanitizeForSQL($username);
$pwdmd5 = md5($password);
$qry = "Select name, email from $this->tablename where username='$username' and password='$pwdmd5' and confirmcode='y'";
$result = mysql_query($qry,$this->connection);
if(!$result || mysql_num_rows($result) <= 0)
{
$this->HandleError("Error logging in. The username or password does not match");
return false;
}
$row = mysql_fetch_assoc($result);
$_SESSION['name_of_user'] = $row['name'];
$_SESSION['email_of_user'] = $row['email'];
$_SESSION['user_name']=$row['username'];
return true;
}
……………………………………………………………………………
this is called in login.php as
if($fgmembersite->Login())
if this return true than user will be directed to login successful page.
but i dont why it is always returning false!and showing the error “Error logging in. The username or password does not match”…
please help.
Edit: I also noticed that in your code, you call one method however, you show us a differently one … I don’t think that is right.
Try adding
or die(mysql_error())to your line:To become:
My guess is your query is failing.