Files
sam-kd/make/insert_new.php

167 lines
7.9 KiB
PHP
Raw Normal View History

<?php session_start(); ?>
<meta charset="utf-8">
<script src="/make/make.js"></script>
<?php
$modify=$_REQUEST["modify"];
$parentnum=$_REQUEST["parentnum"]; // 리스트번호
$upnum=$_REQUEST["upnum"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$num=$_REQUEST["num"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$text1=$_REQUEST["callname"]; // 전달인수가 변수명과 겹치면 오류가 발생해서 받아들이지 않는다.
$text2=$_REQUEST["text2"];
$ordercompany=$_REQUEST["ordercompany"];
$callname=$_REQUEST["callname"];
$cutwidth=$_REQUEST["cutwidth"];
$cutheight=$_REQUEST["cutheight"];
$number=$_REQUEST["number"];
$printside=$_REQUEST["printside"];
$direction=$_REQUEST["direction"];
$exititem=$_REQUEST["exititem"];
$intervalnum=$_REQUEST["intervalnum"];
$intervalnumsecond=$_REQUEST["intervalnumsecond"];
$memo=$_REQUEST["memo"];
$draw=$_REQUEST["draw"];
$drawbottom1=$_REQUEST["drawbottom1"];
$drawbottom2=$_REQUEST["drawbottom2"];
$drawbottom3=$_REQUEST["drawbottom3"];
$cover=$_REQUEST["cover"];
$exitinterval=$_REQUEST["exitinterval"];
$sort=$_REQUEST["sort"];
$outputnum=$_REQUEST["outputnum"];
$left_check=$_REQUEST["left_check"];
$right_check=$_REQUEST["right_check"];
$mid_check=$_REQUEST["mid_check"];
$done_check=$_REQUEST["done_check"];
$remain_check=$_REQUEST["remain_check"];
$text3="";
$text4="";
$text5="";
// print "<script> alert($modify); </script>";
require_once("../lib/mydb.php");
$pdo = db_connect();
if($modify=='1')
{
try{
$sql = "select * from chandj.make where num=?"; // get target record
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1,$num,PDO::PARAM_STR);
$stmh->execute();
$row = $stmh->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
try{
$pdo->beginTransaction();
$sql = "update chandj.make set text1=?, text2=? ,text3=?, text4=? ,text5=?, ordercompany=? , callname=? ,cutwidth=? ,cutheight=? ,number=? ,printside=? ,direction=? ,exititem=? ,intervalnum=? ,intervalnumsecond=? ,memo=? ,draw=? ,drawbottom1=? ,drawbottom2=? ,drawbottom3=? ,upnum=?, exitinterval=?, cover=?, outputnum=?, left_check=?, mid_check=?, right_check=?, done_check=?, remain_check=? ";
$sql .= " where num=? LIMIT 1";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $text1, PDO::PARAM_STR);
$stmh->bindValue(2, $text2, PDO::PARAM_STR);
$stmh->bindValue(3, $text3, PDO::PARAM_STR);
$stmh->bindValue(4, $text4, PDO::PARAM_STR);
$stmh->bindValue(5, $text5, PDO::PARAM_STR);
$stmh->bindValue(6, $ordercompany, PDO::PARAM_STR);
$stmh->bindValue(7, $callname, PDO::PARAM_STR);
$stmh->bindValue(8, $cutwidth, PDO::PARAM_STR);
$stmh->bindValue(9, $cutheight, PDO::PARAM_STR);
$stmh->bindValue(10, $number, PDO::PARAM_STR);
$stmh->bindValue(11, $printside, PDO::PARAM_STR);
$stmh->bindValue(12, $direction, PDO::PARAM_STR);
$stmh->bindValue(13, $exititem, PDO::PARAM_STR);
$stmh->bindValue(14, $intervalnum, PDO::PARAM_STR);
$stmh->bindValue(15, $intervalnumsecond, PDO::PARAM_STR);
$stmh->bindValue(16, $memo, PDO::PARAM_STR);
$stmh->bindValue(17, $draw, PDO::PARAM_STR);
$stmh->bindValue(18, $drawbottom1, PDO::PARAM_STR);
$stmh->bindValue(19, $drawbottom2, PDO::PARAM_STR);
$stmh->bindValue(20, $drawbottom3, PDO::PARAM_STR);
$stmh->bindValue(21, $upnum, PDO::PARAM_STR);
$stmh->bindValue(22, $exitinterval, PDO::PARAM_STR);
$stmh->bindValue(23, $cover, PDO::PARAM_STR);
$stmh->bindValue(24, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(25, $left_check, PDO::PARAM_STR);
$stmh->bindValue(26, $mid_check, PDO::PARAM_STR);
$stmh->bindValue(27, $right_check, PDO::PARAM_STR);
$stmh->bindValue(28, $done_check, PDO::PARAM_STR);
$stmh->bindValue(29, $remain_check, PDO::PARAM_STR);
$stmh->bindValue(30, $num, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
elseif($modify=='2') // sorting 요청
{
}
else
{
// 데이터 신규 등록하는 구간
try{
$pdo->beginTransaction();
$sql = "insert into chandj.make(text1, text2, text3, text4, text5, ";
$sql .= "ordercompany, callname,cutwidth,cutheight,number,printside,direction,exititem,intervalnum,intervalnumsecond,memo,draw,drawbottom1,drawbottom2,drawbottom3,upnum,exitinterval,cover,outputnum,left_check, mid_check, right_check, done_check, remain_check)";
$sql .= " values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
$stmh = $pdo->prepare($sql);
$stmh->bindValue(1, $text1, PDO::PARAM_STR);
$stmh->bindValue(2, $text2, PDO::PARAM_STR);
$stmh->bindValue(3, $text3, PDO::PARAM_STR);
$stmh->bindValue(4, $text4, PDO::PARAM_STR);
$stmh->bindValue(5, $text5, PDO::PARAM_STR);
$stmh->bindValue(6, $ordercompany, PDO::PARAM_STR);
$stmh->bindValue(7, $callname, PDO::PARAM_STR);
$stmh->bindValue(8, $cutwidth, PDO::PARAM_STR);
$stmh->bindValue(9, $cutheight, PDO::PARAM_STR);
$stmh->bindValue(10, $number, PDO::PARAM_STR);
$stmh->bindValue(11, $printside, PDO::PARAM_STR);
$stmh->bindValue(12, $direction, PDO::PARAM_STR);
$stmh->bindValue(13, $exititem, PDO::PARAM_STR);
$stmh->bindValue(14, $intervalnum, PDO::PARAM_STR);
$stmh->bindValue(15, $intervalnumsecond, PDO::PARAM_STR);
$stmh->bindValue(16, $memo, PDO::PARAM_STR);
$stmh->bindValue(17, $draw, PDO::PARAM_STR);
$stmh->bindValue(18, $drawbottom1, PDO::PARAM_STR);
$stmh->bindValue(19, $drawbottom2, PDO::PARAM_STR);
$stmh->bindValue(20, $drawbottom3, PDO::PARAM_STR);
$stmh->bindValue(21, $upnum, PDO::PARAM_STR);
$stmh->bindValue(22, $exitinterval, PDO::PARAM_STR);
$stmh->bindValue(23, $cover, PDO::PARAM_STR);
$stmh->bindValue(24, $outputnum, PDO::PARAM_STR);
$stmh->bindValue(25, $left_check, PDO::PARAM_STR);
$stmh->bindValue(26, $mid_check, PDO::PARAM_STR);
$stmh->bindValue(27, $right_check, PDO::PARAM_STR);
$stmh->bindValue(28, $done_check, PDO::PARAM_STR);
$stmh->bindValue(29, $remain_check, PDO::PARAM_STR);
$stmh->execute();
$pdo->commit();
} catch (PDOException $Exception) {
$pdo->rollBack();
print "오류: ".$Exception->getMessage();
}
}
header("Location:/make/write.php?num=$num&callname=$callname&cutwidth=$cutwidth&cutheight=$cutheight&ordercompany=$ordercompany&outworkplace=$ordercompany&number=$number&printside=$printside&direction=$direction&exititem=$exititem&intervalnum=$intervalnum&intervalnumsecond=$intervalnumsecond&memo=$memo&draw=$draw&drawbottom1=$drawbottom1&drawbottom2=$drawbottom2&drawbottom3=$drawbottom3&text2=$text2&sort=$sort&upnum=$upnum&exitinterval=$exitinterval&cover=$cover&outputnum=$outputnum&parentnum=$parentnum&number=$number&left_check=$left_check&mid_check=$mid_check&right_check=$right_check&done_check=$done_check&remain_check=$remain_check"); // 신규가입일때는 리스트로 이동 ?>