Re: Need to dynamically globalise variables

From: Date: Thu, 16 Aug 2001 17:45:35 +0000
Subject: Re: Need to dynamically globalise variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63082@lists.php.net to get a copy of this message
Use the $GLOBALS array. On Thu, 16 Aug 2001, Tom Hodder wrote: > > I have a function like this... > > function register_db_to_globals( $row ) > { > while( list( $key, $val) = each( $row ) ) > { > global $$key; // (I've tried this with $key as well > print "$key : $val <Br>"; > } > } > > where the function prints this; > > job_ID : 2 > jobTitle : testtestt > jobDesc : esttest > jobShortDesc : > jobSalary : > jobLocation : > client_ID : 2 > jobContractType : 1 > > I want to create global variables from the data ie $job_ID = 2, $jobTitle = > testtestt > > but this is not working, the values are remaining empty. > > Has anyone got any ideas on this. > > Regards > > Tom Hodder > > > -- > > > >

« previous php.general (#63082) next »