12345678910111213141516171819202122232425262728293031323334 |
- <?php
- ini_set('display_errors', 1);
- error_reporting(E_ALL);
- function StartCon(){
- $db = "(DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.2.15)(PORT = 1521))
- (CONNECT_DATA =
- (SERVER = DEDICATED)
- (SERVICE_NAME = ORCLCDB.localdomain)
- ))" ;
- $usr = 'eaton';
- $pwd = 'eaton';
- $conn = oci_connect ($usr, $pwd, $db);
- if (!$conn) {
- $m = oci_error();
- echo $m['message'], "\n";
- exit;
- }
- return $conn;
- }
- function CloseCon($conn){
- oci_close($conn);
- }
- function sqlStm($sql){
- $conn = StartCon();
- $stid = oci_parse($conn, $sql);
- oci_execute($stid);
- $nrows = oci_fetch_all($stid, $res);
- CloseCon($conn);
- return $res;
- }
- ?>
|