Skip to content

Instantly share code, notes, and snippets.

@AnowarCST
Last active August 29, 2015 14:18
Show Gist options
  • Save AnowarCST/4a8fea5916938b9bd158 to your computer and use it in GitHub Desktop.
Save AnowarCST/4a8fea5916938b9bd158 to your computer and use it in GitHub Desktop.
Oracle DB Connection with Query
<?php
class Db {
public $url = 'http://localhost/DashboardObject/';
protected $host = '192.--.--.54';
protected $SID = 'qpro';
protected $userName = 'brac_central_db';
protected $password = '123456';
protected $port = '1521';
protected $db;
public function __construct(){
$this->db = oci_connect($this->userName, $this->password, $this->host.'/'.$this->SID);
if (!$this->db) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
}
public function query($query){
$query = oci_parse($this->db, $query);
oci_execute($query);
$nrows = oci_fetch_all($query, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
return $res;
}
}
@infoshahin
Copy link

Great boss..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment