|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Data in table into an array
Hi, i wonder if anyone can help me.
I have a mysql database which contains a table called "tbl_config" . This table contains two fields, config_name and config_value as shown in the example below. Config_name outlines a series of settings and config_name is the value (both numerical or text) for that setting. Table - tbl_config config_name ------ config_value option_1------ ------1 option_2------ ------0 option_3------ ------main.php I want to be able to query the database using PHP so that i can get an array so i can access the variables something like this- PHP Code:
which would echo the value for that setting ie "0". I'm sure this is fairly simple but i cant work out how to do it and a search on google leads to mainly inserting arrays into a db not the otherway round. Thanks in advance, Andrew |
|
#2
|
|||
|
|||
|
Hi, I managed to get this to work but in case anyone else wants to be able to do something similar I shall post the code i've used. I don't know if its the best way of doing it but it works for me!
Data and table structure as outlined above. PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Data in table into an array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|