I'm new to the forums and could really do with some help on the following...
I've got a mysql query which i'm running to log a user in to a secure section of a website. I've successfully managed this on another website, however with the query i'm running it simply just doesn't return any results even when i know it should, i've used the correct details etc.
Here is my query, which i'm running from the SQL tab within phpmyadmin.
SELECT customer_id, c_name FROM tdb_customers WHERE (email='$e' AND password=SHA1('$p')) AND active='active'
$e and $p are email and password which have been defined earlier in my php login script, but in order to make it work i'm using some information straight from the database:
SELECT customer_id, c_name FROM tdb_customers WHERE (firstname.lastname@example.org' AND password=SHA1('test')) AND active='active'
when i run the query, i get the good old message:
MySQL returned an empty result set (i.e. zero rows).
I've tried breaking down the query and only running certain things such as only select the email address, and this works fine, i actually get a result. So i've come to the conclusion that its the password field which is causing me the problem.
I've used SHA1 to encrypt the users password in a 32 character string. Using a very similar query on a different site, it will 'decode' the password and return the users details as expected.
So im absolutely lost as to where i'm going wrong.
Any help would be greatly appreciated!