Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Database{
- private $db_host = "localhost";
- private $db_user = "123346";
- private $db_pass = "12345";
- private $db_name = "1234";
- public $conn;
- // Create connection
- public function connect(){
- if(!isset($this->conn)){
- $this->conn = new mysqli_connect($this->db_host,$this->db_user,$this->pass,$this->db_name);
- if($this->conn){
- $this->conn = true;
- return true;
- }else{
- $this->conn = false;
- return false;
- }
- }
- }
- public function disconnect(){
- if(isset($this->conn)){
- if(mysqli_close($this->conn)){
- $this->myconn = false;
- echo "connection closed";
- return true;
- } else{
- echo "failed to close connection";
- return false;
- }
- }else{
- echo "no connection prescent";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement