PHP code example of gsu-cetloe / cetloelib-oracle-php

1. Go to this page and download the library: Download gsu-cetloe/cetloelib-oracle-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gsu-cetloe / cetloelib-oracle-php example snippets


use Oracle\OCI\Connection;
use Oracle\OCI\Exception\OCIException;

$db = new Connection('scott', 'tiger', 'dbhost.example.edu:1521/ORCLPDB1', 'AL32UTF8');

$deptNo = 10;
$statement = $db->parse('SELECT empno, ename FROM emp WHERE deptno = :deptno')
    ->bindByName(':deptno', $deptNo);

foreach ($statement->query() as $rowNumber => $row) {
    echo $rowNumber, ': ', $row['ENAME'], PHP_EOL;
}

use Doctrine\DBAL\DriverManager;
use Oracle\Doctrine\OracleDriver;

$conn = DriverManager::getConnection([
    'driverClass' => OracleDriver::class,
    'user' => 'scott',
    'password' => 'tiger',
    'host' => 'dbhost.example.edu',
    'port' => 1521,
    'servicename' => 'ORCLPDB1',
    'charset' => 'AL32UTF8',
]);
sh
git clone https://github.com/GSU-CETLOE/cetloelib-oracle-php.git
cd cetloelib-oracle-php
composer install