Consider the following PHP array:
$config= array(
"Plan" => array( "Type" => "dropdown", "Options" => "value1, value2, value3"),
);
Now, Instead of hardcoding these values(value1, value2 etc); I want these values(value1,value2 etc) to be fetched from a database.
$rs = mysql_query('SELECT value from tbloptions');
$optvalue = mysql_fetch_array($rs);
I have been thinking about this from past half hours but I can’t figure out on How to proceed. Can anyone help?
mysql_fetch_assoc and mysql_fetch_array return one row at a time, so you have to call the function until there are no more rows. For each row, grab the value and insert it into a numerically indexed array. The join function takes each value of that array, and concatenates them into a string, with the specified delimiter: