why iam getting worng username and pwd for correct things in php
<p>this is my checklogin in database function</p>

<pre><code>function CheckLoginInDB($username,$password)
{
    if(!$this-&gt;DBLogin())
    {
        $this-&gt;HandleError("Database login failed!");
        return false;
    }          
    $username = $this-&gt;SanitizeForSQL($username);
    $pwdmd5 = md5($password);
    $qry = "Select name, email from $this-&gt;tablename where username='$username' and password='$pwdmd5' and confirmcode='y'";

    $result = mysql_query($qry,$this-&gt;connection);

    if(!$result || mysql_num_rows($result) &lt;= 0)
    {
        $this-&gt;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;
}
</code></pre>

<p>.......................................................................................
this is called in login.php as</p>

<pre><code>if($fgmembersite-&gt;Login()) 
</code></pre>

<p>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"...</p>

<p>please help.</p>
