title: How to decrypt password in mysql
body: <p>Going straightly to my question, I have read about encrypting password while registering the user.Till here im able to register users with encrypted password by using <code>PASSWORD('$PASS');</code> where <code>$PASS</code> is the users password. My sql table <code>details</code> is as follows :- </p>
  
  <pre><code>FNAME
  LNAME
  EMAIL
  PASS // USED ENCRYPTION AS PASSWORD('$PASS'); HERE.
  </code></pre>
  
  <p>I can't understand how to decrypt the password &amp; use futher in my code i use the following code to use decrypt the password but its not working. !</p>
  
  <pre><code>&lt;?php
  $EMAIL = $_POST['email'];
  $PASS = $_POST['pass'];
  
  mysql_connect('host', 'user', 'pass');
  mysql_select_db('userdb');
  $results = mysql_query(sprintf("SELECT FNAME,LNAME,EMAIL,PASS FROM `details`
  WHERE PASS=PASSWORD('$PASS')", 
  mysql_real_escape_string($EMAIL))) or die(mysql_error()); 
  while($row = mysql_fetch_assoc($results))
  {$rows[1] = $row;} 
  if(!($_COOKIE['pass'] == $rows[1][PASS])) 
  //cookie is set while registering user , which is the decrypted(original) value of password.
  { die("Error occured"); } 
  else { echo "Password entered is correct"; }
  
   ////.....my further code here.
    ?&gt; 
  </code></pre>
  
  <p>Its showing <code>Error occured</code> on the page, which means the password is incorrect. I Also add that this code was working correctly before encryption of password in database.Im new to encryption process ,Your little help is needed which will help me to learn more. Thanks in advance.</p>