Inserting and retrieving a password
I have a password field to allow a user to log into an admin panel, but I'm having trouble with encryption.
Currently I am adding in the users manually through phpMyAdmin with the following SQL
This obvioulsy adds a hashed value into the table. However, when I try and retrieve it for authentication purposes it won't return any rows. What am I doing wrong
insert into table (username, password)
values ('adminuser', md5('adminuserpwd'));
Is there a better way of doing this?
$passCheck = mysql_query("select password from form_admin where password = md5('".$_POST['password']."')");
if(mysql_num_rows($passCheck) == 0)
$error_msg .= "Your password is invalid";