Hi, Thursday, October 3, 2002, 6:01:53 PM, you wrote: O> You know...maybe I should mention where this code is...
O> I have my main file which loads using 'require.once' a second file called O> 'everything.php'. O> Inside everything.php is a class called 'mainclass' which is called by the O> mail file. O> This class ('mainclass') loads the MySQL class from the previous post which O> is stored in yet another file, using require.once. O> MainClass then calls the MySQL->CONNECT and MySQL->CHOOSEDB functions. O> I know this sounds a bit over the top, but it works...at least it O> did...until now. I thought I'd mention the circumstances in case that makes O> a difference, which I suspect it will. O> Thanks again! O> Lewis O> "Orangehairedboy" <[EMAIL PROTECTED]> wrote in message O> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Hi everyone! I can't figure out why this doesn't work. The call to the >> CONNECT function works and it connects with no problem, and it does save O> the >> Resource ID in $this->DBLink[]...however, when CHOOSEDB is called, the >> Resource ID just saved is gone. $this->DBLink is just empty, and I can't >> figure out why... >> >> Can anyone offer insight on this one? >> >> class MySQL >> { >> var $DBLink = array(); >> function CONNECT ( $MyVars , $MyContents ) >> { >> $host = ( $MyVars[PORT] ) ? $MyVars[HOST] . ":" . $MyVars[PORT] : >> $MyVars[HOST]; >> $this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] , >> $MyVars[USERNAME] , $MyVars[PASSWORD] ); >> } >> function CHOOSEDB ( $MyVars , $MyContents ) >> { >> mysql_select_db( $MyVars[DATABASE] , $this->DBLink[$MyVars[LINK]] ); >> } >> } >> >> >> Thanks! >> >> >> Lewis >> >> Looks like you change the name of the index from NAME to LINK and it should be $this->DBLink[$MyVars['LINK']] -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php