Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILE 1:
- class databaseConnection {
- private $host = 'localhost';
- private $database = 'xxxx';
- private $username = 'xxxx';
- private $password = 'xxxx';
- public $mysqli;
- public function __CONSTRUCT() {
- $this->mysqli = new mysqli($this->host,$this->username,$this->password,$this->database);
- }
- }
- FILE 2:
- class stuff {
- public $mysqli;
- function __CONSTRUCT() {
- $this->mysqli = new databaseConnection;
- }
- function createTable() {
- $query = 'CREATE TABLE IF NOT EXISTS '.$this->tableName.'(';
- $query .= 'key VARCHAR(15),';
- $query .= 'code INT(3),';
- $query .= 'image VARCHAR(255),';
- $query .= 'PRIMARY KEY (key)';
- $query .= ');';
- $this->mysqli($query);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement