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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:54:42+00:00 2026-06-15T08:54:42+00:00

I am trying to gather some information from a MySQL database and am having

  • 0

I am trying to gather some information from a MySQL database and am having some issues. I can execute either of my two queries independently, but when I try to execute them both my code fails with the error Call to a member function bind_param() on a non-object in /api/boxes.php on line 20 where Line 20 is $queryFacet = $db->prepare("SELECT item_name FROM kf_facet_items WHERE id IN (SELECT facet_value_id FROM kf_box_data WHERE box_id = ?)");

Here is my code:

$query = $db->prepare("SELECT DISTINCT b.id, b.ownerID, b.transactionID, b.post_date, b.description FROM kf_boxes b JOIN kf_box_data d ON b.id = d.box_id");
$query->execute();
$query->bind_result($id, $owner, $transactionID, $post_date, $description);

while ($query->fetch()) {
    $result['id'] = $id;
    $result['transaction'] = $transactionID;
    $result['post_date'] = $post_date;
    $result['description'] = $description;
    $queryFacet = $db->prepare("SELECT item_name FROM kf_facet_items WHERE id IN (SELECT facet_value_id FROM kf_box_data WHERE box_id = ?)");
    $queryFacet->bind_param('s',$id);
    $queryFacet->execute();
    $queryFacet->bind_result($item_name);
        while ($queryFacet->fetch()) {
            $facets['name'] = $item_name;
            $result['facets'] = $facets;
        }
    $output[] = $result;
}

Anyone have any ideas on what is causing this and more importantly, how to solve it?

  • 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-06-15T08:54:44+00:00Added an answer on June 15, 2026 at 8:54 am

    Problem solved. I wasn’t closing my first statement, which threw mysqli for a tizzy. Adding $query->close(); after the while statement, then adding a for loop for the 2nd query worked as expected.

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

Sidebar

Related Questions

I am trying to automate some of operation and gather information from a microsoft
I am working on scrapy , i am trying to gather some data from
I'm using an SQL query to gather information from a database and C# +
I'm currenlty trying to gather some datas from politifact using simple html dom, but
So I am trying to Delete some items from the database before I Insert
I'm trying to create a system in PHP/Zend that can gather emails from various
I need to gather some statistics in my software and i am trying to
Trying to find some information on this but am unable to get any results
I'm missing some fairly simple syntax I gather. I'm trying to rewrite an element
I am trying to hold on to the information from a form after the

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.