beginTransaction(); $sql = "delete from mirae8440.steelsupplier "; $stmh = $pdo->prepare($sql); $stmh->execute(); $pdo->commit(); } catch (Exception $ex) { $pdo->rollBack(); print "오류: ".$Exception->getMessage(); } // 삭제 후 insert grid 구문 $rec_num = count($steelcompany_arr); for($i=0; $i<$rec_num; $i++) { try{ $pdo->beginTransaction(); $sql = "insert into mirae8440.steelsupplier (company) "; $sql .= " values(?) "; $stmh = $pdo->prepare($sql); $stmh->bindValue(1, $steelcompany_arr[$i] , PDO::PARAM_STR); $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); print "오류: ".$Exception->getMessage(); } } //각각의 정보를 하나의 배열 변수에 넣어준다. $data = array( "steelcompany_arr" => $steelcompany_arr, ); //json 출력 echo(json_encode($data, JSON_UNESCAPED_UNICODE)); ?>