Monday, 26 August 2013

MySQL statement not finding a row with matching data

MySQL statement not finding a row with matching data

On a recent project I am having issues when matching a password in the
database.
The query is as follows:
mysql_query("SELECT * FROM user_accounts WHERE username = '$username' AND
password = '$encryptedPass'")
This outputs
SELECT * FROM user_accounts WHERE username = 'T-McFarlane' AND password =
'äê1\Y¸c'
/code/pre
pIt can find me with just the user but with the password it cannot. I have
echoed out both the database password and the encrypted password provides
and they are exactly identical - this is what is in the database but it
cannot find the matching row./p
pMy question is that does this password contain any special characters or
would there be any other reason that this is failing?/p
pI have tried both utf8_swedish_ci and latin1_swedish_ci for my collation
setting in the database./p

No comments:

Post a Comment