[b]No results in query when using MD5 (help wanted)[/b]

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Tue Feb 04, 2003 4:40 pm

$select = "SELECT * FROM `CustMst` WHERE Name = '$Name' AND Pass = MD5($Pass)"; //No quotes.

If this doesn't work try to assign a variable to the MD5 function and use it in the query.

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Wed Feb 05, 2003 4:14 am

personally I would recommend hashing the password within the PHP scripting only (and through using a include file stored securely) - allows for easy updating of encryption scripting and a more portable future.

function &crypto($data)
$data = MD5($data);
return $data;

$pass = &crypto($_POST['pass']);
mysql_query("INSERT ---------- pass='$pass'
mysql_query("SELECT ---- WHERE pass='$pass'");

Subnotes: MD5 hashing always returns a 32byte long string (whether you are hashing a harddrive, a file, a word, an image or whatever) - `pass` VARCHAR(35) NOT NULL, should suffice for field settings ( (32) should just work, added 3 for leeway tho :))

Post Reply