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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:49:30+00:00 2026-06-05T21:49:30+00:00

The problem I have is that it is giving me a warning in mysqli

  • 0

The problem I have is that it is giving me a warning in mysqli stating this:

Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement in ...on line 89

How can I get rid of the warning?

$questionquery = "
SELECT q.QuestionId, q.QuestionContent, o.OptionType, q.NoofAnswers, GROUP_CONCAT(an.Answer ORDER BY an.Answer SEPARATOR ' ') AS Answer, r.ReplyType, 
       q.QuestionMarks 
  FROM Answer an 
  INNER JOIN Question q ON q.AnswerId = an.AnswerId
  JOIN Reply r ON q.ReplyId = r.ReplyId 
  JOIN Option_Table o ON q.OptionId = o.OptionId 

                 WHERE ";

$i=0;
foreach ($terms as $each) {     
    $i++;         

    if ($i == 1){         
        $questionquery .= "q.QuestionContent LIKE ? ";     
        } else {         
            $questionquery .= "OR q.QuestionContent LIKE ? ";    
             } 
             }  

             $questionquery .= "GROUP BY q.QuestionId, q.SessionId ORDER BY "; $i = 0; foreach ($terms as $each) {     
                 $i++;      

    if ($i != 1)         
    $questionquery .= "+";     
    $questionquery .= "IF(q.QuestionContent LIKE ? ,1,0)"; 
    } 

    $questionquery .= " DESC "; 

    $stmt=$mysqli->prepare($questionquery);      
    $stmt->bind_param('s', $each = '%' . $each . '%');
    $stmt->execute(); 
    $stmt->bind_result($dbQuestionId,$dbQuestionContent,$dbOptionType,$dbNoofAnswers,$dbAnswer,$dbReplyType,$dbQuestionMarks); 
    $questionnum = $stmt->num_rows();

OUTPUT OF SQL:

SELECT q.QuestionId, q.QuestionContent, o.OptionType, q.NoofAnswers, GROUP_CONCAT(an.Answer ORDER BY an.Answer SEPARATOR ' ') AS Answer, r.ReplyType, q.QuestionMarks 

FROM Answer an INNER JOIN Question q ON q.AnswerId = an.AnswerId JOIN Reply r ON q.ReplyId = r.ReplyId JOIN Option_Table o ON q.OptionId = o.OptionId 

WHERE q.QuestionContent LIKE ? 

GROUP BY q.QuestionId, q.SessionId 

ORDER BY IF(q.QuestionContent LIKE ? ,1,0) DESC 
  • 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-05T21:49:32+00:00Added an answer on June 5, 2026 at 9:49 pm

    You seem to have confused MySQLi’s parameter binding method with PDO’s (which accepts an array to execute(). Call bind_param() on $each and pass no parameter to execute().

    $stmt->bind_param('s', $each);
    $stmt->execute();
    

    Note that if you intend to use LIKE queries with % wildcards, those wildcards must be part of the bound variable, such that:

    $each = '%' . $each . '%';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: I have a string that looks like this: [1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18] Question: How can you
I know that many people have had this problem... but I am now having
I have a very simple problem that is giving me a really big headache
well I have that problem, im using a lightbox srcipt and im opening an
The problem I have is that when more rows are added to JTable (jtbls)
The problem: we have jobs that run from a few seconds to a few
In a couple of scripts that I use I have problem that is intermittent.
We are running ColdFusion MX7. One problem we have is that we have a
Problem: I have a table that prints out vertical but I would like it
Problem: I have a value that is set in $record, for instance 1.69. Then

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.