Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- abstract class dbConfig
- {
- private $host;
- private $name;
- private $pass;
- private $database;
- private $table;
- private $connector;
- function __construct($hostname = NULL, $username = NULL, $pass = NULL, $database = NULL, $prefix = NULL, $connector = NULL)
- {
- $this->hostname = !empty($hostname) ? $hostname : "";
- $this->username = !empty($username) ? $username : "";
- $this->pass = !empty($pass) ? $pass : "";
- $this->database = !empty($database) ? $database : "";
- $this->table = !empty($table) ? $table : "";
- $this->connector = !empty($connector) ? $connector : ""; //mysql of mysqli waarde opgeven (database)
- }
- public function getHost()
- {
- return $this->host;
- }
- public function getName()
- {
- return $this->name;
- }
- public function getPass()
- {
- return $this->pass;
- }
- public function getDatabase()
- {
- return $this->database;
- }
- public function getTable()
- {
- return $this->table;
- }
- public function getConnector()
- {
- return $this->connector;
- }
- function __destruct()
- {
- #destruction!
- }
- }
- class dbConnect
- {
- private $link;
- public function __construct($dbConfig)
- {
- }
- public function openConnection()
- {
- return $this->openConnection;
- }
- public function closeConnection()
- {
- return $this->closeConnection;
- }
- public function getLink()
- {
- return $this->link;
- }
- }
- class dbConnectMySQL extends dbConnect
- {
- public function openConnection()
- {
- try
- {
- $this->openConnect = mysql_connect($this->hostname, $this->username, $this->pass);
- $this->databaseConnect = mysql_select_db($this->database);
- }
- catch (Exception $e)
- {
- return $e;
- }
- }
- public function closeConnection()
- {
- try {
- mysql_close($this->openConnect);
- }
- catch (Exception $e)
- {
- return $e;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement