Jump to content

Dynamically Naming Variables


squiggerz

Recommended Posts

Ok, I'm pulling values from a db, the values are all domain names.

 

Is there any way after pulling them in with a while loop, that I can define a variable name as the value of what I have pulled?

$query = "SELECT city FROM cities ORDER BY city";
$results = mysql_query($query);
while ($row = mysql_fetch_array ($results, MYSQL_ASSOC)) 
{
           $thisiswhereIwantTheValueToGo = $row['city'];
} 			

 

I understand that the above will make the value of the variable = to the $row['city'], is there any way I can dynamically create the variable name based on that same value?

Link to comment
https://forums.phpfreaks.com/topic/66473-dynamically-naming-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.