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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:14:51+00:00 2026-06-09T12:14:51+00:00

In my case, I’m deleting from multiple tables using LEFT JOIN and need to

  • 0

In my case, I’m deleting from multiple tables using LEFT JOIN and need to provide an array of question ids to delete. The array of question ids is $questions_to_delete.

Not being able to bind an array as a parameter through mysqli is kind of a pain, and I’ve looked through a few SO questions to arrive at this:

$params = implode(',', array_fill(0, count($questions_to_delete), '?'));
$types = array_fill(0, count($questions_to_delete), 'i');
$delete_questions = $mysqli->prepare('DELETE    ...
                                          FROM questions
                                          LEFT JOIN ...
                                          WHERE questions.id IN ('.$params.')');

call_user_func_array(array(&$delete_questions, 'bind_param'), array_merge($types, $questions_to_delete));
$delete_questions->execute();
$delete_questions->close();

The error I’m getting is

Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn’t match number of bind variables

I noticed that some answers used &$delete_questions versus $delete_questions, but I’m stumped as to what PHP is complaining about.

  • 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-09T12:14:52+00:00Added an answer on June 9, 2026 at 12:14 pm

    I wasn’t merging $types and $questions_to_delete correctly! In my original code:

    // Produces ['i', 'i', 'i', ...]
    $types = array_fill(0, count($questions_to_delete), 'i');
    
    // The argument (array_merge) is then ['i', 'i', ..., 'id1', 'id2', ...]
    call_user_func_array(array($delete_questions, 'bind_param'), array_merge($types,$questions_to_delete));
    

    What eventually worked for me was:

    // Produces 'iii..'
    $types = str_repeat('i', $questions_to_delete);
    
    // The argument (array_merge) is then ['iii...', 'id1', 'id2', ...]
    call_user_func_array(array($delete_questions, 'bind_param'), array_merge(array($types),$questions_to_delete));
    

    So the types of the parameters need to be a String at the beginning of the parameters array.

    I don’t really understand how call_user_func_array handles array(mysqli_stmt, 'bind_param') as a callable, or why the parameters have to be constructed this way, and I’d like to see if anyone can come up with an explanation!

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

Sidebar

Related Questions

Case: I need to feed my application a URL from any location on the
Case in point : I've got a handle to a window (for instance, using
Case 1 >>> datetime.__file__ '/usr/lib/python2.6/lib-dynload/datetime.so' >>> print datetime.datetime.now() 2010-05-19 19:45:40.202634 Case 2 from django.db
Case: I receive a JSON string from third-party server, containing a list of objects.
Case 1: multiple definitions of a function module1.cpp: void f(){} main.cpp: void f(){} //
Case: Developing a standalone java client which will run on different locations on multiple
Case 1 in question: I have been trying to have a pure 64-bit development
Case A (function(){ //this is to access this a property PublicItem from outside this
CASE WHEN VPN_Access__c = True THEN 'Need to Setup' + VPN_Access__c ELSE '' END
select case when cntrctr_lcns_seq_no is null then 1 else max(cntrctr_lcns_seq_no) end as cntrctr_lcns_seq_no from

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.