Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001032

Re: [PHP] linking classes together From: Yasuo Ohgaki (yohgaki <email protected>)
Date: 03/21/01

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 <email protected> > For additional commands, e-mail: php-general-help <email protected> > To contact the list administrators, e-mail: php-list-admin <email protected> >

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>