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

  • Home
  • SEARCH
  • 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 4063018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:40:19+00:00 2026-05-20T15:40:19+00:00

.Hi everyone i need a little help for my dropdown menu. .I already know

  • 0

.Hi everyone i need a little help for my dropdown menu.
.I already know how to populate a dropdown list from a database but what i want to do is to fill my dropdown list with the list of databases available in my MySQL server. can anyone please help me with the proper coding for this one. Thanks in advance! by the way i am using php.

update:

.alright i tried this:

$sql = "SHOW databases";
$result = mysql_query($sql);
echo '<form method="post" id="try" action="pillar.php">';
echo '<select name="batch" id="batch">';
echo '<option>';
while($r = mysql_fetch_assoc($result)) 
{
    $database = $r['Database'];
echo '<option>'.$database.'</option>';
}

echo '</select><br>';
echo '<input type="submit">';
echo '</form>';

IT works! but is there a way that i could exclude any of the retrieved values? because what i want to output on my dropdown is the list of batch which is the databases. but what happens is that the dropdown includes the default databases of MySQL. like “information_schema” and “mysql”.

  • 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-20T15:40:20+00:00Added an answer on May 20, 2026 at 3:40 pm
    while($r = mysql_fetch_assoc($result)) 
    {
        if($r['Database'] == 'information_schema' 
           || $r['Database'] == 'test'
           || $r['Database'] == 'mysql' ){
        }else{
            $database = $r['Database'];
            echo '<option>'.$database.'</option>';
        }
    }
    

    (I don’t want to many FALSE operators in a single if clause, hence the action in else)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help with overlaying views using the prism framework.Its a little more
I can't create a NT account for everyone that need access to the reports.
I need to grant rights to Windows user group Everyone to the HKCR hive
I need to find a reg ex that only allows alphanumeric. So far, everyone
Everyone (at least everyone who uses a compiled language) has faced compilation errors but
Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided
Everyone I work with is obsessed with the data-centric approach to enterprise development and
Everyone has accidentally forgotten the WHERE clause on a DELETE query and blasted some
Everyone has this huge massively parallelized supercomputer on their desktop in the form of
Everyone managing open-source-software runs into the problem, that with the time the process of

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.