Created
June 30, 2012 17:28
-
-
Save Addvilz/3024731 to your computer and use it in GitHub Desktop.
MySQLi extends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* SQL base class, extends MySQLi | |
* | |
*/ | |
class Sql extends MySQLi{ | |
/** | |
* MySQLi __construct override with autoconnect | |
* | |
* @return void | |
* | |
*/ | |
public function __construct() { | |
global $_CONFIG; | |
parent::__construct($_CONFIG['sql']['host'], $_CONFIG['sql']['user'], $_CONFIG['sql']['pass'], $_CONFIG['sql']['default_db']); | |
if (mysqli_connect_error()) { | |
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment