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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:50:14+00:00 2026-05-22T01:50:14+00:00

i just need a little help on how i could implement this function. i

  • 0

i just need a little help on how i could implement this function. i cant quite read this. I found this function to stick the results from a mysqli prepared statement query into an array which is what i am trying to do, but i am unsure how to use the function.

$meta = $statement->result_metadata(); 

while ($field = $meta->fetch_field()) { 
    $params[] = &$row[$field->name]; 
} 

call_user_func_array(array($statement, 'bind_result'), $params);                
while ($statement->fetch()) { 
    foreach($row as $key => $val) { 
        $c[$key] = $val; 
    } 
    $hits[] = $c; 
} 
$statement->close();
  • 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-22T01:50:15+00:00Added an answer on May 22, 2026 at 1:50 am
    while ($field = $meta->fetch_field()) { 
        $params[] = &$row[$field->name]; 
    }
    

    This looks at the result set and extracts the field names into an array.

    call_user_func_array(array($statement, 'bind_result'), $params);                
    

    That array of field names is then used to auto-create variables of the same name as the field, to which the database results are bound to. This is very bad practice, as it auto-creates variables based on query results, and can potentially overwrite a variable you’d be using for other purposes elsewhere. You’d never know why, because there’s no explicit assignment to that variable name to search for.

    The while loop is highly inefficient, but retrieves each row from the query results and places them into an array called $hits.

    So, basically, it’s a gold plated piece of bovine excrement that impressively does very little.

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

Sidebar

Related Questions

guess its getting late, and Im a beginner, just need a little help.. Im
Just need a little bit of Javascript to warn people that press the back
I've just started a project and need a little push in the right direction.
I just need to rename JQgrid column dynamically as per user selection from a
In this website I've found a function to convert seconds in an human readable
I'm writing my first rails plugin and could use a little help. In a
I know this has been addressed many times, but i just cant seem to
I need a little bit of help here. First off, I am not sure
Hey all, working on a C++ little game, Connect 3. This is just like
Just need get some vals located in application.ini(main ini) in the Controller plugin I

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.