11-09-2007, 09:51 PM
|
#18 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 835
Thanks: 31
|
PHP Code:
function __autoload($class) { include_once($class . '.php'); }
class DBfactory { public static $pDB;
public static function factory($szType = "") { if(!is_object(self::$pDB)) { switch($szType) { case 'mysql': self::$pDB = new DBmysql; break; case 'mssql': self::$pDB = new DBmssql; break; default: self::$pDB = new DBmysql; break; } } return self::$pDB; } }
Like that :), sorry if i didnt make it clear, __autoload cant be a class method it must be outside of the class.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|