Is seems like you post one thread a year (skipped 2018) with the same fundamental problem in it.
You are reusing the $result variable inside of the loop, so after the 1st pass through the loop it is no longer the result from the select query. It’s it result from the UPDATE query, which is either a boolen true or false
Thank you for the response.
I only post about once a year because I only play with php about once a year - like the username says Noobie. My question probably has the same fundamental problem in it because I never seem to solve the entire problem.
Removing the $result in the loop is a help but it brought me back to my original problem before I messed it up further:
the echo diplays what I want (id and unique sequence for each id) but the database has the same value for all rows, i.e., the first randonString for everyone. That is why I tried the unset which didnt work.
I know my “unique” sequence is not great but it a small number generated and a one time use.