Skip to content

Instantly share code, notes, and snippets.

@rikardhassel
Created August 21, 2014 09:14
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 rikardhassel/9f97a20ca74f9200be4f to your computer and use it in GitHub Desktop.
Save rikardhassel/9f97a20ca74f9200be4f to your computer and use it in GitHub Desktop.
private $_link = null;
/**
* Private function connect()
* This function is the basic code for the call to mySQLi. Returns a link to server.
* @return object
*/
private function connect()
{
if ( $this->_link === null )
{
$this->_link = new mysqli( $GLOBALS['db_host'], $GLOBALS['db_user'], $GLOBALS['db_pass'], $GLOBALS['db_db'] ) or die( mysqli_error( $link ) );
$this->_link->set_charset( 'utf8' );
}
return $this->_link;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment