return self::$instance; } // End Singleton Methods public function getUserByID($id) { $db = DB::getInstance(); $result = $db->query("SELECT ID, Name, Email, Access FROM User WHERE ID = ?", array($id)); if (empty($result) || count($result) != 1) { return FALSE; } // Idiot Check - We should only have 1 user for that ID $user = new User(); $result = $result[0]; foreach ($result as $key => $value) { $user->{$key} = $value; } return $user; } } Config::$dbuser = '******'; Config::$dbpass = '******'; Config::$dbhost = 'localhost'; Config::$dbname = 'test'; // now pretend this is in a controller $userfactory = UserFactory::getInstance(); $user = $userfactory->getUserByID(1); if ($user->isAdmin()) { echo "Woot! you're an admin!"; } else { echo "You're a pleb"; }