Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class access{
- var $host = null;
- var $user = null;
- var $pass = null;
- var $name = null;
- var $conn = null;
- //Constructor
- function __construct($dbhost, $dbuser, $dbpass, $dbname) {
- $this->host = $dbhost;
- $this->user = $dbuser;
- $this->pass = $dbname;
- $this->name = $dbname;
- }
- public function connect(){
- $this->conn = new mysqli($this->host, $this->user, $this->pass, $this->name);
- if (mysqli_connect_errno()){
- //Verbindung zur Datenbank fehlgeschlagen
- return false;
- }else{
- //Verbindung zur Datenbank erfolgreich hergestellt;
- return true;
- }
- }
- public function disconnect(){
- // IF Connection exists
- if ($this->conn != null){
- $this->conn->close();
- }else{
- return;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement