Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- class exdb {
- private static $connection = false; private $query; private $result; public function __construct($query, $params=array()) {
- if (self::$connection === false) {
- $this->connect();
- }
- $this->query = $query;
- $this->query();
- }
- public function connect() {
- $host = DB_HOST;
- $user = DB_USER;
- $password = DB_PASSWORD;
- $database = DB_DATABASE;
- self::$connection = new mysqli($host, $user, $password, $database);
- }
- public function query() {
- $this->result = self::$connection->query($this->query);
- return $this->result;
- }
- public function fetch_assoc() {
- if (!$row = $this->result->fetch_assoc()) {
- return false;
- }
- return $row;
- }
- public function __call($name,$args){
- return call_user_func_array(array(self::$connection,$name),$args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement