title: Can't login with encrypted password from database
body: <p>I can encrypt my password with md5 by simply wrapping it around - </p>
  
  <pre><code>$Password = md5($_POST['password']);
  </code></pre>
  
  <p>The encrypted password gets stored in the database successfully when the user registers. However when i want to login with the plain text password, it decides not too. How can I solve this issue?</p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['btnlogin'])) {
  
  $Email = $_POST['email'];
  $Password = $_POST['password'];
  
  
  
  $Email = mysqli_real_escape_string($connection, $Email);
  $Password = mysqli_real_escape_string($connection, $Password);
  
  $query ="SELECT * FROM customers WHERE Email = '{$Email}' AND Password =   '{$Password}'";
  
  
  $select_customer_query = mysqli_query($connection, $query);
  
  if (!$select_customer_query)
  
  die("QUERY FAILED". mysqli_error($connection));
  
  }
  
  while($row = mysqli_fetch_array($select_customer_query)) {
  
  $Email_db = $row['Email'];
  $Password_db = $row['Password'];
  $Firstname_db = $row['First_Name'];
  $Lastname_db = $row['Last_Name'];
  $string ="logged in as";
  $logoutlink = '/ &lt;a href="includes/back/logout.php"&gt;Logout&lt;/a&gt;';
  
  
  
  } 
  
  
  if ($Email_db == $Email || $Password_db == $Password  ) {
  
  
  header("Location: ../../index.php");
  
  
  
  $_SESSION['FirstName'] = $Firstname_db;
  $_SESSION['LastName'] = $Lastname_db;
  $_SESSION['string'] = $string;
  $_SESSION['logoutlink'] = $logoutlink;
  
  
  } 
  
  
  ?&gt;
  </code></pre>