I'm working on creating a mass update feature for records in the database of an app I've created. The script takes all the information from certain columns in a table places it in a form so the user can go through and update multiple records, click one update button and have all their changes committed to the database. The script works but I'm worried that it creates too many db queries. A db update is created for each field. So if there are 200 rows and 20 fields the script will create 4000 update queries. Here you can see what I'm doing:

The HTML is created for each field. The "name" is the field name in the db and the number at the end is the db id and the "value" is what is stored in the db. So in this example, there would be 20 fields with id 120.
HTML Code:
<input type="text" name="first_name-120" size="40" value="Ann" />
This is the PHP that handles the form submit. It takes everything submitted, splits out the db id, and creates a new array with the id, the field name, and the value for the database. Then it places those values into an update query. You can see it does this for each field.

PHP Code:
// Handle the update
if (isset($_POST['submitted'])) {
    foreach (
$_POST AS $k => $v) {
// Get the child_id off the form name and create a new array
$kv explode('-'$k);
// Add the field value to the array
$qpost "UPDATE children SET {$kv[0]} = '{$kv[2]}' WHERE child_id = '{$kv[1]}'";
$rpost mysqli_query($dbc$qpost);

What I wanted to do but just can't figure how to do it is to take everything with the same id number and place it into the same update. Then, in this example, I would go from 4000 updates to 200 with. What would be even better is to only submit fields that have changed. Again, I'm not sure how I would do that.