Converting MySQL rows/fields
Added by astuffedtiger on 2017-05-16 19:22:37
connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}

echo "
";

$result = mysqli_query($db, "SELECT * FROM users");
if (!$result) {
    echo 'Could not run query: ' . ((is_object($db)) ? mysqli_error($db) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
}
while ($row = mysqli_fetch_array($result)) {
    $userid = $row['userid'];
    $password = $row['password'];
    
    $hash = password_hash($password, PASSWORD_DEFAULT);
    
    echo "Hashing Password to new format.........
UserID: $userid.........
Current Hash: $password..........
New Hash:$hash......

"; mysqli_query($db, "UPDATE users SET password2 = '$hash' WHERE userid = '$userid'"); } echo "
"; ?>