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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:52:49+00:00 2026-05-11T02:52:49+00:00

I have the following code, for which I get the error: Warning : mysqli_stmt::bind_result()

  • 0

I have the following code, for which I get the error:

Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn’t match number of fields in prepared statement in file.

If this is only a warning, shouldn’t the code still work? I want to do a select * and display all the data except one field, which I want to bind and handle separately. Is there any way around, or a better method? My solution at the moment(untried) is to bind the correct amount of variables to the results with getRecords, and then bind separately as a different name with getHtml.

What are the advanatges of binding, and is it necessary.

<?php if (isset($_GET['cmd']))   $cmd = $_GET['cmd']; else   die('You should have a 'cmd' parameter in your URL'); $id = $_GET['id']; $con = mysqli_connect('localhost', 'user', 'password', 'db'); if (!$con) {     echo 'Can't connect to MySQL Server. Errorcode: %s\n'. mysqli_connect_error();     exit; } $con->set_charset('utf8'); echo 'test outside loop'; if($cmd=='GetSaleData') {     echo 'test inside loop';     if ($getRecords = $con->prepare('SELECT SELECT Product_NO, Product_NAME, SUBTITLE, CURRENT_BID, START_PRICE, BID_COUNT, QUANT_TOTAL, QUANT_SOLD, ACCESSSTARTS, ACCESSENDS, ACCESSORIGIN_END, USERNAME, BEST_BIDDER_ID, FINISHED, WATCH, BUYITNOW_PRICE, PIC_URL, PRIVATE_AUCTION, AUCTION_TYPE, ACCESSINSERT_DATE, ACCESSUPDATE_DATE, CAT_DESC, CAT_PATH, COUNTRYCODE, LOCATION, CONDITIONS, REVISED, PAYPAL_ACCEPT, PRE_TERMINATED, SHIPPING_TO, FEE_INSERTION, FEE_FINAL, FEE_LISTING, PIC_XXL, PIC_DIASHOW, PIC_COUNT, ITEM_SITE_ID FROM Sales WHERE Product_NO = ?')) FROM SaleS WHERE PRODUCT_NO = ?')) {         $getHtml = $con->prepare('SELECT PRODUCT_DESC FROM SaleS WHERE PRODUCT_NO = ?');         $getHtml->bind_param('i', $id);         $getHtml->execute();         $getHtml->bind_result($PRODUCT_DESC);         $getRecords->bind_param('i', $id);         $getRecords->execute();         $getRecords->bind_result($PRODUCT_NO, $PRODUCT_NAME, $SUBTITLE, $CURRENT_BID, $START_PRICE, $BID_COUNT, $QUANT_TOTAL, $QUANT_SOLD, $ACCESSSTARTS, $ACCESSENDS, $ACCESSORIGIN_END, $USERNAME, $BEST_BIDDER_ID, $FINISHED, $WATCH, $BUYITNOW_PRICE, $PIC_URL, $PRIVATE_Sale, $Sale_TYPE, $ACCESSINSERT_DATE, $ACCESSUPDATE_DATE, $CAT_DESC, $CAT_PATH, $COUNTRYCODE, $LOCATION, $CONDITIONS, $REVISED, $PAYPAL_ACCEPT, $PRE_TERMINATED, $SHIPPING_TO, $FEE_INSERTION,          $FEE_FINAL, $FEE_LISTING, $PIC_XXL, $PIC_DIASHOW, $PIC_COUNT, $ITEM_SITE_ID);         while ($getRecords->fetch()) {             // operations snipped for question             echo '<h1>'.$PRODUCT_NAME.'</h1> <div id='leftlayer' class='leftlayer'> <p><strong>Username: </strong>'.$USERNAME.' <p><strong>Shipping to: </strong> '. $country .' <img src='./images/'.$id.'.jpg'' width=''.$imageSize['width'].'' height=''.$imageSize['height'].''> </div> <div id='rightlayer'>  </div>'; // }  } } } 

I would also like to know what is wrong with my img src statement…, I feel I am mising something elementary such as a slash or quote.

edit: The code now displays an error after replace * with column names, however the while loop is never entered, and hence no actions are performed.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T02:52:50+00:00Added an answer on May 11, 2026 at 2:52 am

    You may need to explicity state the column names in your SELECT rather than use *, as per the examples for MySQLi bind_result().

    In relation to the img line, you have an extra ‘ after .jpg

    <img src='./images/'.$id.'.jpg'' width= 

    should be

    <img src='./images/'.$id.'.jpg width= 

    Also, you don’t actually need to break out of the string and concatenate the variables because using ‘ will cause the string to be parsed for variables anyway.

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

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 117k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This error can mean many things but for me, this… May 11, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer See also :h undo-redo, which lists all the commands and… May 11, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer You are missing the point of the 'support' method. You… May 11, 2026 at 10:41 pm

Related Questions

Consider i have an assembly(class library dll) which i have loaded using the following
I am trying to use the following code, which I have not been able
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
I have a web reference for our report server embedded in our application. The

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.