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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:42:44+00:00 2026-05-25T12:42:44+00:00

I created a function i intent to use in running my queries: function selectquery

  • 0

I created a function i intent to use in running my queries:

function selectquery ($sql, $params)
    {
       $connection = getConnect ();
       $result = $connection->prepare("$sql");
       $result->bind_param($params);
       $status = $result->execute();
       $return=array('obj'=>$result, 'status' => $status, 'data'=>array());
       $meta = $connection->result_metadata();  
       while ( $field = $meta->fetch_field() ) 
       {  
            $parameters[] = &$row[$field->name];  
       }  
       call_user_func_array(array($result, 'bind_result'), $parameters);  

       while ( $stmt->fetch()) 
       {  
          $x = array();  
          foreach( $row as $key => $val ) 
          {  
             $x[$key] = $val;  
          }  
          $return['data'][] = $x;  
       } 
       $result->close(); 
       return $return; 
    }

And this is how i run my query:

$resultobj=selectquery ("select id from employers where subdomain = ? ", "s, $reg_subdomain");

It comes up with this error:

Warning: Wrong parameter count for mysqli_stmt::bind_param() in /home/kju/public_html/ejjk.com/functions.php on line 42

Fatal error: Call to undefined method mysqli::result_metadata() in /home/kju/public_html/ejjk.com/functions.php on line 45

What is the possible problem and how can i get it fixed

Thanks

  • 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-25T12:42:45+00:00Added an answer on May 25, 2026 at 12:42 pm

    mysqli_stmt::bind_param expects 2 parameters, but you are passing one :

    function selectquery ($sql, $params) . {}
     ...
    selectquery("....? ", "s, $reg_subdomain" // 1 string parameter, not 2);
    
    // it should be
    function selectquery ($sql, $types, $params) . {
     ... bind_param($sql, $types, $params);
    }
    selectquery("....? ", "s", $reg_subdomain // 2 parameters);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a function that takes a SQL command and produces output that
I am getting deadlocks occasionally in sql server. I created a function for locking
I am trying to use set function in App Engine, to prepare a list
I have created a function outside of $(document).ready() , but am still using jQuery
I recently created a function in javascript that takes in a file name and
I have created a function in PHP that calls a webservice and parses through
in my data layer class I have created a function to manually refresh the
I'm using C structs in objc and I've created a function that assembles the
Hey, so I have created a function to check the DB for unique entries,
I am a beginner programmer, using python on Mac. I created a function as

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.