I’ve done some Google’ing and it’s brought up nothing so I’m asking here.
I’m trying to run this query (the language is PHP):
SELECT * FROM table WHERE MD5(field1) = '$var'
It’s not returning any rows,
Any help is greatly appreciated.
P.S.
I’ve tried some variations such as “SELECT field1 as name FROM table WHERE MD5(name) = ‘$var'” but it still doesn’t work.
EDIT:
I figured it out. A lot of the answers to this question are assuming a lot of things such as 1. it’s for a login system (it’s for something related, but not for a login system), 2. i’m not hashing my values before saving them in the db (I am, but this certain situation requires me not knowing the plaintext, thus requiring me to MD5 the column in the SQL query). A lot of these assumptions were made because I simplified the hell out of the example to convey my question. Thank you to those who tried answering.
Yes, MySQL has a built in MD5 function.
should work fine. If it’s not returning any rows then you must be doing something else wrong.