title: I have hash my password, but when I login, it does not recognize
body: <p>Previously i have hash my password with this </p>
  
  <pre><code>$password = hash('sha256' , $salt.$password_arr[$i]);
  </code></pre>
  
  <p>and in config.php , i have this code to salt the password </p>
  
  <pre><code>$salt = 'jhfdkjdhfTyhdh3365@jdh69kkshhQAAAiyeg';
  </code></pre>
  
  <p>So my sql database display the hash code when i register a new pass into it, im happy with that, but when i login, it seems it does not recognize my password because the authentication is directly authenticate from the database data. So what can i do to make it work</p>
  
  <p>Here's my code for login verification</p>
  
  <pre><code>&lt;?php 
  session_start();
  include('adminconfig.php');
  // username and password sent from form
  $username=$_POST['userID'];
  $password=$_POST['password'];
  
  // To protect MySQL injection (more detail about MySQL injection)
  $username = stripslashes($username);
  $password = stripslashes($password);
  $username = mysql_real_escape_string($username);
  $password = mysql_real_escape_string($password);
  
  $sql="SELECT * FROM admin WHERE ID='$username' and
  password='$password'";
  $result=mysql_query($sql);
  
  $count=mysql_num_rows($result);
  
  if($result &amp;&amp; $count==1){
  $_SESSION['userID']= $_POST['userID'];
  header('location:adminprofile.php');
  }
  else {
  header('location:adminmessage.php');
  die;
  }
  ?&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>