Re: linking classes together

From: Date: Thu, 22 Mar 2001 00:46:30 +0000
Subject: Re: linking classes together
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45040@lists.php.net to get a copy of this message
SNIP > // This does not work --> > class sessions { > function sessions { > $db = new mysql_connect; > } > > function testprint() { > $db-> connect() > } > } This does not work as it shouldn't. You create $db in another function => other function cannot use. Make it class member variable. > function sessions { > $db = new mysql_connect; $this->db = new mysql_connect; > } > > function testprint() { > $db-> connect() $this->db->connect(); > } Regards, -- Yasuo Ohgaki > $sess = new sessions; > $sess-> testprint(); > > Any thoughts? > // Tobias > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#45040) next »