CON006_1_1.php
2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
//*****************************************************************************
//*
//* プログラム名:申請情報DB設定処理
//* プログラムID:CON006_1_1
//* 機能 :申請情報をDB設定する
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
//*****************************************************************************
//* インクルードファイル
//*****************************************************************************
include("include/session_start.inc"); //セッション開始
include("include/SessionChk.inc"); //セッションチェック
include("include/dbcon.inc"); //DB接続
//新規登録
if ($_POST["sinsei_syubetu"] == "") {
$strSql = "SELECT MAX(sinsei_syubetu) as a,MAX(sinsei_syubetu) as b FROM mst_sinsei";
$rsResult = pg_exec($pg_con,$strSql);
$intSinseiNextValue = pg_result($rsResult,0,"a") + 1;
$intRankNextValue = pg_result($rsResult,0,"b") + 1;
$strSql = "INSERT INTO mst_sinsei VALUES(";
$strSql = $strSql."'$intSinseiNextValue','".addslashes($_POST["sinsei_name"])."')";
$rsResult = pg_exec($pg_con,$strSql);
$sinsei_syubetu = $intSinseiNextValue;
//修正
}else{
$strSql = "SELECT * FROM mst_sinsei where sinsei_syubetu=".$_POST["sinsei_syubetu"] ;
$rsResult = pg_exec($pg_con,$strSql);
$intCt=pg_numrows($rsResult);
if($intCt!=0){
$strSql = "UPDATE mst_sinsei SET ";
$strSql .= "sinsei_name='".addslashes($_POST["sinsei_name"])."' ";
$strSql .= "WHERE sinsei_syubetu =".$_POST["sinsei_syubetu"] ;
$rsResult = pg_exec($pg_con,$strSql);
}else{
$strSql = "SELECT MAX(sinsei_syubetu) as a,MAX(sinsei_syubetu) as b FROM mst_sinsei";
$rsResult = pg_exec($pg_con,$strSql);
$intSinseiNextValue = pg_result($rsResult,0,"a") + 1;
$intRankNextValue = pg_result($rsResult,0,"b") + 1;
$strSql = "INSERT INTO mst_sinsei VALUES(";
$strSql = $strSql."'$intSinseiNextValue','".addslashes($_POST["sinsei_name"])."')";
$rsResult = pg_exec($pg_con,$strSql);
}
}
$strSql = "DELETE from kessaisya_tbl where sinsei_syubetu=".$_POST["sinsei_syubetu"] ;
$rsResult = pg_exec($pg_con,$strSql);
$intKessaisyaCnt = 0;
if ($syain_cd1 != "") {
$intKessaisyaCnt = $intKessaisyaCnt + 1;
}
if ($syain_cd2 != "") {
$intKessaisyaCnt = $intKessaisyaCnt + 1;
}
if ($syain_cd3 != "") {
$intKessaisyaCnt = $intKessaisyaCnt + 1;
}
if ($syain_cd4 != "") {
$intKessaisyaCnt = $intKessaisyaCnt + 1;
}
if ($syain_cd5 != "") {
$intKessaisyaCnt = $intKessaisyaCnt + 1;
}
$strSql = "INSERT INTO kessaisya_tbl VALUES(";
$strSql = $strSql."$sinsei_syubetu,'$syain_cd1','$syain_cd2','$syain_cd3','$syain_cd4','$syain_cd5',$intKessaisyaCnt)";
$rsResult = pg_exec($pg_con,$strSql);
header("Location: CON006.php");
?>