conn = OCILogon($user, $passwd)) { return(TRUE); } else { return(FALSE); } } function logoff() // disconnect Oracle DB { OCILogoff($this->conn); } function selectExec($sql) // select文実行 { if(($conn = $this->conn) == FALSE) return(FALSE); $this->rows = array(); $arr = array(); $stmt = OCIParse($conn, $sql); if(OCIExecute($stmt, OCI_DEFAULT) ) { while(OCIFetchInto($stmt, &$arr, OCI_ASSOC)) { $this->rows[] = $arr; } OCIFreeStatement($stmt); return(TRUE); } else { return(FALSE); } } function getEmp() // SELECT * FROM EMP { $sql = "select * from emp"; return($this->selectExec($sql)); } function getDept() // SELECT * FROM DEPT { $sql = "select * from dept"; return($this->selectExec($sql)); } } function viewTable($arr) { echo "\n"; while(list($c, $row) = each($arr)) { echo "\n"; while(list($col, $value) = each($row)) { echo "\n"; } echo "\n"; } echo "
$value
\n"; } function viewEMP($arr) { echo "\n"; echo "\n"; while(list($c, $row) = each($arr)) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
EMPNOENAMEJOBHIREDATE
". $row['EMPNO'] ."". $row['ENAME'] ."". $row['JOB'] ."". $row['HIREDATE'] ."
\n"; } ?> Example:PHP Class getEmp()) { // viewTable($scott->rows); viewEMP($scott->rows); // EMP 表表示関数 } // DEPT 表を表示する if($scott->getDept()) { viewTable($scott->rows); } $scott->logoff(); } ?>