Trouble verifying database password

Posted on 16th Feb 2014 by admin

Thankyou to everyone who responded to my last post (I can't find the posting, it has been buried).

I am currently making a login form and the associated php code. It all seems to work apart from the part below. I am constantly being told in the output error 'The password you entered is not correct' . When I register a user, my registration code adds the password to the database in an md5 encrypted state. I think it has something to do with that and have tried looking up md5 encryption but still don't understand why I am not able to verify my password entered on the login page with the one registered in the database.

Quote//Verify password entered matches stored password md5?
$loginname = mysql_real_escape_string($_POST['loginname']);
$pwd = md5($_POST['loginpwd']);
$verify = mysql_query("SELECT loginpwd FROM members WHERE loginname = '$loginname' ");
if ($verify != $pwd)
{die('The password you entered is not correct');}
Thanks in advance.

Other forums