View Single Post
Old 09-17-2007, 06:22 PM   #13 (permalink)
Haris
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

PHP Code:
          /**
        ||||||||||||||||||||||||||||||||||||||||||
        |||| Our constructor that auto-loads
        ||||||||||||||||||||||||||||||||||||||||||
        **/
          
private function __construct($host$user$pass) {
            
            
            if(
strlen($host) > && strlen($user) > && strlen($pass) > 0) {
                
                
$this->db['host'] = $host;
                
$this->db['user'] = $user;
                
$this->db['pass'] = $pass;
                
                
$this->connectdb();
                
            } else {
                
                
$this->connectdb();
                
            }
                        
        } 
I think this could be further made shorter into the following because even though it doesn't pass the strlen function, it still tries to connect to the database.

PHP Code:
          /**
        ||||||||||||||||||||||||||||||||||||||||||
        |||| Our constructor that auto-loads
        ||||||||||||||||||||||||||||||||||||||||||
        **/
          
private function __construct($host$user$pass) {
                
                
$this->db['host'] = $host;
                
$this->db['user'] = $user;
                
$this->db['pass'] = $pass;

                
$this->connectdb();
                        
        } 
Haris is offline  
Reply With Quote