View Single Post
Old 10-05-2008, 08:05 PM   #2 (permalink)
Enfernikus
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 322
Thanks: 2
Enfernikus is on a distinguished road
Default

Let's say the name of your DB class is MySQLAccess

PHP Code:

<?php

class user
{
    private 
$db;
        
        public function 
__construct(MySQLAccess $db)
        {
            
$this->db $db;
        }
}

$db = new MySQLAccess($dbInfo);
$user = new user($db);

?>
This way the user class will NEED the object MySQLAccess to start up or it'll give off a fatal error.
Enfernikus is offline  
Reply With Quote