I am trying to port all passwords from one value to another value (each user), so I am looking for an applicable way to port all of them in MySQL, I am basically looking to run my crypt function over all $row['password'].
currently I have a SELECT and instead of doing a seperate UPDATE I was thinking how to do this in one connection.
I've written my SELECT so far and I have an array of my model.
$query = "SELECT * FROM t_user";
$result = mysqli_query($dbc,$query);
$encryption_service = new EncryptionService;
$newUserSet = [];
foreach ($result as $row){
$row['password'] = $encryption_service->encrypt($password);
$newUserSet[] = $row;
}
How would I update all rows for password column in one query? I'm a bit confused on how to read a balue and then invoke a function on the value in an update statement.