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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:59:03+00:00 2026-06-12T07:59:03+00:00

I have a mysqli function that is inserting a row into a table. I’m

  • 0

I have a mysqli function that is inserting a row into a table. I’m getting back the error

Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of 
fields in prepared statement

This is odd to me since I thought insert nto returns true or false. Here is the function that is using the sql statement.

function add_project_deadline ($mysqli, $project_id, $deadline) {


if ($stmt = $mysqli->prepare("INSERT INTO `project_deadline` (project_id, deadline) 
    VALUES (?, ?)")){
    $stmt->bind_param('is', $project_id, $deadline);
    $stmt->execute();
    $stmt->bind_result($return);
    $stmt->close();
    return $return;
} else {return false;}  

}

My question is why am I getting this bind_result error and how do I fix 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-12T07:59:04+00:00Added an answer on June 12, 2026 at 7:59 am

    Since you are executing an INSERT query which doesn’t have any results, you don’t need or use bind_result for fetching data. bind_result is for binding to columns used in a SELECT statement.

    mysqli_stmt::execute() returns true on success or false on failure so simply assign the value of that to your $return variable.

    If execute() returns false, the INSERT statement failed for some reason. If it returns true, the INSERT was successful and you can determine the number of rows inserted by looking at the mysqli_stmt::$affected_rows property of your statement object.

    That’s why you’re getting that error, hope it helps. You can find most of this information on the manual page for mysqli_stmt::execute().

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

Sidebar

Related Questions

I have a table with an auto-incrementing ID. After inserting a new row, I
I have this simple insert into query that seems to be outputting an error
I have a simple function that looks at an incoming mySQL data type and
I have a PHP function which inserts multiple records into MySQL: function commit_purchase($asset_type_ID, $org_ID,
I have a MySQL database and with a php function i made a table
I am having some trouble inserting an array into the sql database. my error
Here's the thing, I don't have access to code that inserts data into a
I have a MySQL database table that has a VARCHAR field storing a date
I'm making a function that takes a table name and a key value array
I have a function that insert new users to a database. If the input

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.