Hash2=".$hashed_password2; $con=mysqli_connect("localhost","username","password","lrr"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "Connected "; } mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $query = "SELECT * from users_table;"; $result = mysqli_query($con, $query); if (mysqli_num_rows($result) > 0) { echo ""; while ($row = mysqli_fetch_assoc($result)) { $id=$row["User_ID"]; $pass=$row["Password"]; $hash_pass=hash('sha512', $pass); $inner_query = "update users_table set HashPassword='$hash_pass' where User_ID=$id;"; if ($con->query($inner_query) === TRUE) { echo " User # $id updated
"; } //echo ""; //echo ""; //echo ""; } echo "
{$row['Password']}{$row['Email']}
"; }