I have currently hit a dead-end with my coding, I am rewriting a huge chunk of code that is related to both changing site wide options that are stored in a database, and also the same for applying permissions on individual users accounts.
On the settings page, I have various settings stored in a database that I want to retrieve from the database to form my page, with the results I have retrieved I then populate a select box for each individual setting with “enabled” or “disabled”, as most of the settings are either 0 or 1.
My question is, what is the best way to fetch the data from the database and create dynamic variables to then use in my settings page? The structure of the table is: id | setting_name | setting_value. I only need setting_name and value, and I would like it if each variable that is made within the while loop was as follows;
setting_name = setting_value;
This is so then I can use that variable to populate my select box.
$sql_query = mysql_query( "SELECT * FROM `setting`" );
while( $row = mysql_fetch_assoc( $sql_query ) )
{
$row['name'] = $row['value'];
}
I thought the code above would work, however the variable is never created.
Thanks for any help,
One more $:
$$row['name'] = $row['value']