Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

php hash passwords

I use below code to hash all the passwords in my database, however when I use below code, all passwords become the same?
what do I do wrong?

$sql = "SELECT _key,uid,pwd FROM KullaniciBilgileri2";
$result = $conn->query($sql);


    // output data of each row
    while($row = $result->fetch_assoc()) {
       
            
      $_key= $row["_key"];
      $uid= $row["uid"];
      
$pwd= hash ('sha256', $row["pwd"]);
      
$sql2 = "UPDATE KullaniciBilgileri2 SET pwd = '$pwd' where uid = '$uid' ";
$result2 = $conn->query($sql2);      

echo "id: " . $row["_key"]. " - İsim: " . $row["uid"]. " " . $row["pwd"]. "<br>";
      
            
      }
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

thank you, I figure that out.