md5 sql query
Posted 21 September 2006 - 02:34 AM
$r = my_query("select id,email from users where md5(email)=$email");
list($toid,$email) = mysql_fetch_row($r);
Thanks in advance
Posted 21 September 2006 - 02:40 AM
<?php $md5_email = md5($email); $sql = "SELECT id, email FROM users WHERE email = '$md5_email'"; ?>
Out of curiosity, why would you store an email address in an MD5 hash anyway. Impossible to change one in the db and you can't show it.
Posted 21 September 2006 - 02:47 AM
Can't work like ^^^ that.
the email address are stored normally in the database. I md5'd them when I displayed them in a form on the previous page where users can checkbox the required user they want to email. The purpose being that I don't want them to be visable when you 'view source'.
So now they're parsed already encrypted and now need to match up with the unencrypted data.
does that make any sense at all LOL.
Posted 21 September 2006 - 03:26 AM
has anyone else ever seen it being used like this?
Posted 25 September 2006 - 01:09 PM
1. create field type=varchar length=32
2. use this sql UPDATE tablename SET md5_email_field = md5(e-mail_field)
Now you have it set
Let me know if you need more help
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users