Home >Backend Development >PHP Tutorial >Use foreach to traverse and update data. How to prompt completion after traversal?
foreach ($last_names as $var) {
$re = pdo_update('mc_members', array('xianxiajifen' => 1000), array('uid' => $var));
}
The above is the statement of foreach. I want that after the foreach is completed, the page prompt has been updated. Can I just echo the completion directly at the back?
foreach ($last_names as $var) {
$re = pdo_update('mc_members', array('xianxiajifen' => 1000), array('uid' => $var));
}
The above is the statement of foreach. I want that after the foreach is completed, the page prompt has been updated. Can I just echo the completion directly at the back?
Dare to think and do it. You already have an idea, why don’t you try it? It only takes 10 seconds to do an experiment. How long are you wasting by posting this post? Your idea is right.
Just write it after foreach
Because the data is relatively small, it will be displayed as soon as I refresh the page. I thought it was not implemented. Thank you both upstairs!
Use transactions to ensure atomicity of updates.