I have a function to calculate which inputs MD5 of the user id and outputs the id,name
public function verifyUser($enc)
{
//echo $enc;
$query = $this->db->prepare("SELECT id,name FROM `users` WHERE MD5(`id`) = '$enc'");
//$query->bindValue(1,$enc);
$query->execute();
$data = $query->fetch();
//var_dump($query);
return $data;
}
But the above query always results NULL.
eg I have a user with id=2
and MD5(2)
is c81e728d9d4c2f636f067f89cc14862c
. The query it generates is :
SELECT id,name FROM
usersWHERE MD5(
id) = 'c81e728d9d4c2f636f067f89cc14862c'
But though the user exits , it results null.