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 3632252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:30:07+00:00 2026-05-19T00:30:07+00:00

ive got 2 dropdown menu that retrieve the file from the database. but it

  • 0

ive got 2 dropdown menu that retrieve the file from the database. but it gives me an error when im trying to get the the 2nd file.

The first dropdown, successfully retrieved but the second one gives me an error?

in PHP class

class treatment{
function __construct($mysqli){}

// Get treatment list
function get_t_dermal_filler(){
    global $mysqli;
    $q = $mysqli->query("SELECT * FROM t_dermal_filler ORDER BY t_dermal_name ASC");
    while ($r = $q->fetch_array(MYSQLI_ASSOC)) :    
        echo '<option value="' . $r['id_t_dermal_filler'] . '" >' . $r['t_dermal_name'] . '</option>';  
    endwhile;

    $mysqli->close();   
}

// Get treatment list
function get_t_wrinkle_rel(){   
    global $mysqli;
    $q = $mysqli->query("SELECT * FROM t_wrinkle_rel");     
    while ($r = $q->fetch_array(MYSQLI_ASSOC)) :    
        echo '<option value="' . $r['id_t_wrinkle_rel'] . '" >' . $r['t_wrinkle_name'] . '</option>';   
    endwhile;           
    $mysqli->close();   
}
 }

in webpage

$treatment = new treatment($mysqli);
<?= $treatment->get_t_dermal_filler();?>
<?= $treatment->get_t_wrinkle_rel();?>

the error

 <b>Warning</b>:  mysqli::query() [<a href='mysqli.query'>mysqli.query</a>]: Couldn't fetch mysqli in <b>
  • 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-19T00:30:08+00:00Added an answer on May 19, 2026 at 12:30 am

    I think the problem is the closing of the mysqli

    remove them from both functions, and then after asking for all the data, close it.

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

Sidebar

Related Questions

I've got a simple dropdown menu that I want to hide whenever you click
I've long thought (but never practiced for some reason) that a dropdown menu that
I've got an animated dropdown menu with animated subnavs that works beautifully in FF,
I've been trying to get this to work but it's got me stumped. I
I've got a dropdown list that is being populated via a webservice using ASP>NET
I've got a menu in Python. That part was easy. I'm using raw_input() to
I've got a web application that I'm trying to optimize. Some of the controls
I've got a drop down menu here that just plain won't show up in
I've got a menu bar that slides across the page when an image is
I'm building a dropdown menu and I've got an issue showed on this img:

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.