CON003_1_1.php
1.54 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
<?php
//*****************************************************************************
//*
//* プログラム名:部門情報DB設定処理
//* プログラムID:CON003_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["syozoku_cd"] == "") {
$strSql = "SELECT MAX(syozoku_cd) as a FROM mst_bumon";
$rsResult = pg_exec($pg_con,$strSql);
$intSyozokuNextValue = pg_result($rsResult,0,"a") + 1;
if($intSyozokuNextValue == 99){
//99はMYグループのためスキップ
$intSyozokuNextValue = $intSyozokuNextValue + 1;
}
$strSql = "SELECT MAX(disp_rank) as b FROM mst_bumon Where del_flg=0 ";
$rsResult = pg_exec($pg_con,$strSql);
$intRankNextValue = pg_result($rsResult,0,"b") + 1;
$strSql = "INSERT INTO mst_bumon (syozoku_cd, bumon_name, disp_rank, del_flg) VALUES(";
$strSql = $strSql . "'$intSyozokuNextValue','".addslashes($_POST["bumon_name"])."',$intRankNextValue,0)";
$rsResult = pg_exec($pg_con,$strSql);
//修正
}else{
$strSql = "UPDATE mst_bumon SET ";
$strSql .= "bumon_name='".addslashes($_POST["bumon_name"])."' ";
$strSql .= "WHERE syozoku_cd =".$_POST["syozoku_cd"] ;
$rsResult = pg_exec($pg_con,$strSql);
}
header("Location: CON003.php");
?>