Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('config.php');
- class Connect{
- private $host;
- private $admin;
- private $pass;
- private $db;
- private $link;
- function __construct() {
- $this->host = $db_host;
- $this->user = $db_user;
- $this->pass = $db_pass;
- $this->db = $db_database;
- $this->connectDB();
- echo $this->host;
- }
- function __destruct() {
- $this->closeDB();
- }
- private function connectDB(){
- $this->link = mysql_connect($this->host,$this->user,$this->pass) or die('Unable to establish a DB connection');
- mysql_select_db($this->db,$this->link);
- }
- public function query($query){
- if(!$this->link){
- $this->connectDB();
- }
- $this->result = mysql_query($query) or die(mysql_error());
- return $this->result;
- }
- private function closeDB(){
- return mysql_close();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment