Last active
August 29, 2015 14:18
-
-
Save AnowarCST/4a8fea5916938b9bd158 to your computer and use it in GitHub Desktop.
Oracle DB Connection with Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great boss..