beginTransaction(); $sql = "update " . $DB . "." . $table . " set " . $field . "=? "; $sql .= " where num=? LIMIT 1"; $stmh = $pdo->prepare($sql); $stmh->bindValue(1, $strtmp, PDO::PARAM_STR); $stmh->bindValue(2, $recnum, PDO::PARAM_STR); $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); print "오류: ".$Exception->getMessage(); } } // delete인 경우 if($command=='delete') { try{ $pdo->beginTransaction(); $sql = "delete from " . $DB . "." . $table . " where num = ? " ; $stmh = $pdo->prepare($sql); $stmh->bindValue(1, $recnum, PDO::PARAM_STR); $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); print "오류: ".$Exception->getMessage(); } } // insert인 경우 if($command=='insert') { $sql = "insert into " . $DB . "." . $table . " ( " ; for($j=0;$jbeginTransaction(); $stmh = $pdo->prepare($sql); for($i=0;$ibindValue($i+1,$strarr[$i],PDO::PARAM_STR); $stmh->execute(); $pdo->commit(); } catch (PDOException $Exception) { $pdo->rollBack(); print "오류: ".$Exception->getMessage(); } } //각각의 정보를 하나의 배열 변수에 넣어준다. $data = array( "command" => $command, "recnum" => $recnum, "field" => $field, "table" => $table, "strtmp" => $strtmp, "strarr" => $strarr, "fieldstrarr" => $fieldstrarr, "sql" => $sql, ); //json 출력 echo(json_encode($data, JSON_UNESCAPED_UNICODE)); ?>