Thread: uhum???
View Single Post
Old 11-21-2007, 01:00 PM   #3 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

But, I've used this in DB.php:

php Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2007
||||||||||||||||||||||||||||||||||||||||||
**/


    function __autoload($database) {
       
        include_once('databases/' . $database . '.php');
       
    }

    class DB {
       
        public static $DB;

        public static function getInstance($type) {
       
            if(!is_object(self::$DB)) {
               
                $type = strtolower($type);
               
                switch($type) {
                   
                    case 'mysql':
                    
                        self::$DB = new DBmysql();
                        break;
                        
                    case 'mssql':
                    
                        self::$DB = new DBmssql();
                        break;
                        
                    default:
                    
                        self::$DB = new DBmysql();
                        break;
                        
                }
               
            }
           
         return self::$DB;
   
        }

    }


?>

So it should create the object for me... :S
Tanax is offline  
Reply With Quote