Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6171605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:14:40+00:00 2026-05-23T23:14:40+00:00

Consider the following PHP array: $config= array( Plan => array( Type => dropdown, Options

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:14:40+00:00Added an answer on May 23, 2026 at 11:14 pm

    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:

    while ($row = mysql_fetch_assoc($rs)) {
        $opt[] = $row['value'];
    }
    
    $config['Options'] = implode(', ', $opt);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

consider the following PHP code: <?php $searchsport = $_REQUEST['sport']; $sportarray = array( Football =>
Consider the following piece of code: $tests = array( array (a, b, c), array
Consider the following code <?php $username = root; $password = ; $host = localhost;
Consider the following PHP code: <?php require_once(myDBclass.php); class a { private $tablename; private $column;
Consider following array $details = array( array('lname'=>'A', 'fname'=>'P','membkey'=>700,'head'=>'y'), array('lname'=>'B', 'fname'=>'Q','membkey'=>540,'head'=>'n'), array('lname'=>'C', 'fname'=>'R','membkey'=>700,'head'=>'n'), array('lname'=>'D', 'fname'=>'S','membkey'=>540,'head'=>'y'),
Consider the following command line output using grep: [gjempty@gjempty]$ find . -name *.php |
Please consider the following code: <?php class MyException extends Exception {} function global_exception_handler($exception) {
I would like to ask probably simple question. Consider following php page: <p>Name of
Consider the following scenario: Page written in classic ASP or PHP, which is rendering
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.