I thought someone might mention that, but that is actually correct. The problem is that the variable assigned on the line $this->DBLink[$MyVars[NAME]] = mysql_connect( $MyVars[HOST] , $MyVars[USERNAME] , $MyVars[PASSWORD] ); dissapears and can't be retreived on the line mysql_select_db( $MyVars[DATABASE] , $this->DBLink[$MyVars[LINK]] );.
For instance, if the first line saves $this->DBLink["TEST"], when CHOOSEDB is called, the command PRINT $this->DBLink["TEST"] will print nothing when the same line right after the variable is saved would produce something like "Resource ID #38". That's the brain twister. Thanks though! ::Lewis "Tom Rogers" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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

