NameSilo

Naming A Variable With Another Variable?

Spaceship Spaceship
Watch

beaver6813

Established Member
Impact
16
Hey,

PHP:
$query = mysql_query("SELECT * FROM `table`");
$setprep = mysql_fetch_assoc($query);
foreach ($setprep as $key=>$value) {
$keyname = "$key";
$keyname = $value;
}
^^^^^< Doesn't work :(

Basically its retrieving settings from a database, i need it to name the variable based on its $key. But its all quite confusing and i can't figure out how to do it. I know i can do it with an array, say $settings[$key]. But i just want the seperate variables. Is it possible?

So all i want is the key as the variable name.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
1
•••
Aha ;) Worked it out just before you posted. Thanks a lot though nice to know you guys are here for me ^^ _\|/_
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back