$t2 = microtime(true);
 $ps = NULL;
 for ($i = 0; $i < count($accountIds); $i++) {
     $accountId = $accountIds[$i];
     $newBudget = $newBudgets[$i];
     $budgetId = $budgetIds[$i];
     $defaultBudget = $defaultBudgets[$i];
     $comments = $budgetComments[$i];
     if (empty($budgetId)) {
         // not editing, so set to -1
         $budgetId = -1;
     }
     // update budget
     $budget = new Budget();
     $budget->Init_budget($accountId, $budgetDate, $newBudget, $comments, $budgetId);
     $error = $budget->Save($pdo, $ps);
     if ($error != '') {
         break;
     }
     // update default budget
     $account = new Account();
     $account->Init_for_budget_update($accountId, $defaultBudget);
     $error = $account->Update_budget_default($pdo, $ps);
     if ($error != '') {
         break;
     }
 }
 if ($error == '') {
     $t3 = microtime(true);
     $pdo->commit();
     $t4 = microtime(true);