"error", "message" => "등록할 직원 정보가 없습니다."]); exit; } $pdo->beginTransaction(); $sql = "INSERT INTO {$DB}.almember (name, company, part, dateofentry, referencedate, availableday, service_based, initial_less_than_one_year) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $stmh = $pdo->prepare($sql); foreach ($authorList as $author) { $name = $author['name'] ?? ""; $company = $author['company'] ?? ""; $part = $author['part'] ?? ""; $dateofentry = $author['dateofentry'] ?? '' ; $availableday = $author['availableday'] ?? '' ; $service_based = $author['service_based'] ?? '' ; $initial_less_than_one_year = $author['initial_less_than_one_year'] ?? '' ; // 각 직원의 데이터를 삽입 $stmh->bindValue(1, $name, PDO::PARAM_STR); $stmh->bindValue(2, $company, PDO::PARAM_STR); $stmh->bindValue(3, $part, PDO::PARAM_STR); $stmh->bindValue(4, $dateofentry, PDO::PARAM_STR); // 입사일 $stmh->bindValue(5, $currentYear, PDO::PARAM_STR); // 해당 연도 $stmh->bindValue(6, $availableday, PDO::PARAM_INT); // 계산된 연차 발생일수 $stmh->bindValue(7, $service_based, PDO::PARAM_INT); $stmh->bindValue(8, $initial_less_than_one_year, PDO::PARAM_INT); $stmh->execute(); } $pdo->commit(); echo json_encode(["status" => "success", "message" => "대량 등록이 성공적으로 완료되었습니다."]); } catch (PDOException $e) { $pdo->rollBack(); echo json_encode(["status" => "error", "message" => "DB 오류: " . $e->getMessage()]); exit; } ?>