Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(Path::databaseClassPath() . 'Database.php');
- class DatabaseHandler {
- private $mysqli;
- public function __construct() {
- $this->connect();
- }
- private function connect() {
- $this->mysqli = new mysqli(DB::host(), DB::username(), DB::password(), DB::name());
- if($this->mysqli->connect_errno) {
- die("Unable to connect to database: $mysqli->connect_errno - $mysqli->connect_error");
- }
- return $this->mysqli;
- }
- public function prepare($query) {
- return $this->mysqli->prepare($query);
- }
- public function stmt_init() {
- return $this->mysqli->stmt_init();
- }
- public function close() {
- if(isset($mysqli))
- $this->mysqli->close();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment