Selecting PASSWORD() value in MySQL
| From: | Tim Haak | Date: | Thu, 10 Oct 2002 19:45:40 +0000 |
| Subject: | Selecting PASSWORD() value in MySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-22324@lists.php.net to get a copy of this message | ||
Hello,
I'm trying to retrieve data from a MySQL table which contains data encrypted with the MySQL
"PASSWORD()" function from a PHP script but I can't seem to get it to work. Below is
the query I'm trying:
SELECT * FROM user_data WHERE username = 'thaak' AND password =
PASSWORD('thaak');
I then tried the following subquery/subselect:
SELECT * FROM user_data WHERE username = 'thaak' AND password IN (SELECT
PASSWORD('thaak') FROM user_data);
...which also didn't work.
If I just execute "SELECT PASSWORD('thaak')" from the MySQL command line it
returns the same value stored in the password column of my user_data table. I verified these
queries at the MySQL command line so I don't think it's a PHP problem.
I need to compare the password the user enters to log in against the password stored in the DB. In
addition to the "PASSWORD()" function, I also tried "MD5()" and
"ENCRYPT()" but they also failed. Can someone please help me accomplish this or point me
to some resources that might help?
Thanks!
Tim Haak