Need to dynamically globalise variables

From: Date: Thu, 16 Aug 2001 17:48:15 +0000
Subject: Need to dynamically globalise variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63080@lists.php.net to get a copy of this message
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 (#63080) next »