Added AdressDB + AddressDB API
This commit is contained in:
@@ -26,14 +26,22 @@ class FronkDB {
|
||||
|
||||
public static function singleton($host=false,$user=false,$pass=false,$db=false) {
|
||||
$instance_name = $host.$user.$db;
|
||||
if(!isset(self::$instances[$instance_name])) {
|
||||
if(!$instance_name) {
|
||||
$instance_name = "default";
|
||||
}
|
||||
|
||||
if(!isset(self::$instances[$instance_name])) {
|
||||
//echo "new FronkDB instance $instance_name\n";
|
||||
$c = __CLASS__;
|
||||
self::$instances[$instance_name] = new $c($host,$user,$pass,$db);
|
||||
}
|
||||
} else {
|
||||
//echo "existing FronkDB instance $instance_name\n";
|
||||
}
|
||||
return self::$instances[$instance_name];
|
||||
}
|
||||
|
||||
private function connect() {
|
||||
//echo "FronkDB connection to ".$this->host." (".$this->user.", ".$this->db.")\n";
|
||||
if(!$this->link) {
|
||||
$this->link=mysqli_connect($this->host,$this->user,$this->pass,$this->db) or die("Error connecting to database...".mysqli_error($this->link));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user