Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public $db_name;
- public $db_user;
- public $db_pass;
- public $db_host;
- public $connection;
- public function connection(){
- $this->db_host = HOST;
- $this->db_user = DB_USERNAME;
- $this->db_pass = DB_PASSWORD;
- $this->db_name = DB_NAME;
- $this->connection = new mysqli($this->db_host, $this->db_user, $this->db_pass, $this->db_name);
- //return new mysqli('localhost', 'root', '', 'dbcdce');
- //return $this->connect($this->db_host, $this->db_user, $this->db_pass, $this->db_name);
- }
- function connect($host, $user, $pass, $db_name) {
- $this->connection = new mysqli($host, $user, $pass, $db_name);
- if ( mysqli_connect_errno() ) {
- printf("Connection failed: %s", mysqli_connect_error());
- exit();
- }
- return $this->connection;
- }
- public function query($sql)
- {
- return $this->connection->query($sql);
- }
Add Comment
Please, Sign In to add comment