<?
class app_db
{
private $dbconn;
static $instance;
private function __clone(){}
static function instance()
{
if(empty(self::$instance)) self::$instance=new app_db();
return self::$instance;
}
public function __construct() {
global $config;
$this->dbconn = mysql_connect($config['db']['host'], $config['db']['user'], $config['db']['password']);
if($this->dbconn) {
mysql_select_db($config['db']['database']);
mysql_query("SET NAMES 'utf8'");
}
}
}
?>
6 lis 2009