Home >Backend Development >PHP Tutorial >Use foreach to traverse and update data. How to prompt completion after traversal?

Use foreach to traverse and update data. How to prompt completion after traversal?

WBOY
WBOYOriginal
2016-07-06 13:52:281237browse

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?

Reply content:

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is this sentence wrong?Next article:Is this sentence wrong?