, 로 변환함 $colarr1[$i] = pipetocomma($colarr1[$i]); $colarr2[$i] = pipetocomma($colarr2[$i]); $colarr3[$i] = pipetocomma($colarr3[$i]); $colarr4[$i] = pipetocomma($colarr4[$i]); $colarr5[$i] = pipetocomma($colarr5[$i]); $colarr6[$i] = pipetocomma($colarr6[$i]); $colarr7[$i] = pipetocomma($colarr7[$i]); $colarr8[$i] = pipetocomma($colarr8[$i]); $colarr9[$i] = pipetocomma($colarr9[$i]); $colarr10[$i] = pipetocomma($colarr10[$i]); $colarr11[$i] = pipetocomma($colarr11[$i]); $colarr12[$i] = pipetocomma($colarr12[$i]); $colarr13[$i] = pipetocomma($colarr13[$i]); try { $pdo->beginTransaction(); // 입력 데이터 수집 $lot_no = $colarr1[$i]; $inspection_date = $colarr2[$i]; $supplier = $colarr3[$i]; $item_name = $colarr4[$i]; $specification = $colarr5[$i]; $unit = $colarr6[$i]; $received_qty = $colarr7[$i]; $material_no = $colarr8[$i]; $manufacturer = $colarr9[$i]; $remarks = $colarr10[$i]; $purchase_price_excl_vat = $colarr11[$i]; $weight_kg = $colarr12[$i]; // searchtag 생성 $searchtag = $lot_no . ' ' . $inspection_date . ' ' . $supplier . ' ' . $item_name . ' ' . $specification . ' ' . $unit . ' ' . $received_qty . ' ' . $material_no . ' ' . $manufacturer . ' ' . $remarks . ' ' . $purchase_price_excl_vat . ' ' . $weight_kg; // SQL 쿼리 생성 (삽입) $sql = "INSERT INTO " . $DB . "." . $tablename . " ("; $sql .= "lot_no, inspection_date, supplier, item_name, specification, unit, received_qty, material_no, manufacturer, remarks, purchase_price_excl_vat, weight_kg, searchtag"; $sql .= ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $stmh = $pdo->prepare($sql); // 변수 바인딩 $stmh->bindValue(1, $lot_no, PDO::PARAM_STR); $stmh->bindValue(2, $inspection_date, PDO::PARAM_STR); $stmh->bindValue(3, $supplier, PDO::PARAM_STR); $stmh->bindValue(4, $item_name, PDO::PARAM_STR); $stmh->bindValue(5, $specification, PDO::PARAM_STR); $stmh->bindValue(6, $unit, PDO::PARAM_STR); $stmh->bindValue(7, str_replace(',', '', $received_qty), PDO::PARAM_STR); $stmh->bindValue(8, $material_no, PDO::PARAM_STR); $stmh->bindValue(9, $manufacturer, PDO::PARAM_STR); $stmh->bindValue(10, $remarks, PDO::PARAM_STR); $stmh->bindValue(11, str_replace(',', '', $purchase_price_excl_vat), PDO::PARAM_STR); $stmh->bindValue(12, str_replace(',', '', $weight_kg), PDO::PARAM_STR); $stmh->bindValue(13, $searchtag, PDO::PARAM_STR); // Execute the statement $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); print "오류: " . $Exception->getMessage(); } } } //각각의 정보를 하나의 배열 변수에 넣어준다. $data = array( "colarr1" => $colarr1 ); //json 출력 echo(json_encode($data, JSON_UNESCAPED_UNICODE)); ?>