dbcon.inc
983 Bytes
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
<?php
//*****************************************************************************
//*
//* プログラム名:DataBase Connection
//* プログラムID:dbcon.inc
//* 機能 :PostgreSQLに接続する
//* 作成者 :K.Yoshimura
//*
//*****************************************************************************
include("session_start.inc");
$hostname="localhost";
// $database="e-gru_pro_test";
$database=$PHP_DB_NAME;
if( !$pg_con=pg_connect("host=$hostname dbname=$database user=nobody") ) {
print "Error : connect to ${hostname}<br>";
exit;
}
$strSQL = "SELECT kanri_bit FROM mst_kanri WHERE syain_cd ='$PHP_SYAIN_CD' ";
$objRecBit = pg_exec($strSQL);
if($objRecBit==false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
if (pg_numrows($objRecBit)>0){
$objDataBit = pg_fetch_object($objRecBit, 0);
$PHP_BIT[0]=(int)substr($objDataBit->kanri_bit , 0 , 1);
$PHP_BIT[1]=(int)substr($objDataBit->kanri_bit , 1 , 1);
}else{
$PHP_BIT[0]=0;
$PHP_BIT[1]=0;
}
?>