Skip to content

Instantly share code, notes, and snippets.

@dustinlakin
Created April 5, 2012 09:04
Show Gist options
  • Save dustinlakin/2309349 to your computer and use it in GitHub Desktop.
Save dustinlakin/2309349 to your computer and use it in GitHub Desktop.
Settings Database
<?php
//inside helpers/Settings.php class
public function db() {
if ($this->db == null) {
$server = "localhost";
$user = "root";
$pass = "";
$dbName = "test";
$this->db = new mysqli($server, $user, $pass, $dbName);
}
return $this->db;
}
//at the bottom of helpers/Settings.php file
function db(){
global $config;
return $config->db();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment