Skip to content

Instantly share code, notes, and snippets.

@Addvilz
Created June 30, 2012 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Addvilz/3024731 to your computer and use it in GitHub Desktop.
Save Addvilz/3024731 to your computer and use it in GitHub Desktop.
MySQLi extends
<?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