Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DbConn {
- private static $instance;
- private $db;
- private $dbserver;
- private $username;
- private $password;
- private $database;
- private $error;
- public function __construct() {
- $this->dbserver = 'localhost';
- $this->username = 'kick';
- $this->password = '1@kick';
- $this->database = 'kickstartapp';
- try {
- $this->db = new PDO("mysql:host=".$this->dbserver.";dbname=".$this->database, $this->username, $this->password);
- } catch(PDOException $e) {
- $this->error = $e->getMessage();
- }
- }
- public static function getInstance() {
- if(!self::$instance) {
- self::$instance = new self();
- }
- return self::$instance;
- }
- public function getDb() {
- return $this->db;
- }
- }
- class Database {
- public $db;
- public function __construct() {
- $dbconn = DbConn::getInstance();
- $this->db = $dbconn->getDb();
- }
- public function dbselect($table, $select, $where=NULL) {
- }
- public function dbadd($tablename, $insert, $format) {
- }
- public function dbupdate($tablename, $insert, $where) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement