<bdo id='h4XhB'></bdo><ul id='h4XhB'></ul>
      <i id='h4XhB'><tr id='h4XhB'><dt id='h4XhB'><q id='h4XhB'><span id='h4XhB'><b id='h4XhB'><form id='h4XhB'><ins id='h4XhB'></ins><ul id='h4XhB'></ul><sub id='h4XhB'></sub></form><legend id='h4XhB'></legend><bdo id='h4XhB'><pre id='h4XhB'><center id='h4XhB'></center></pre></bdo></b><th id='h4XhB'></th></span></q></dt></tr></i><div id='h4XhB'><tfoot id='h4XhB'></tfoot><dl id='h4XhB'><fieldset id='h4XhB'></fieldset></dl></div>
      <tfoot id='h4XhB'></tfoot>
    1. <small id='h4XhB'></small><noframes id='h4XhB'>

        <legend id='h4XhB'><style id='h4XhB'><dir id='h4XhB'><q id='h4XhB'></q></dir></style></legend>

        php, mysqli-stmt.bind-param]:类型定义字符串中的元素数

        时间:2023-07-30
          <tbody id='wyoBV'></tbody>

        <i id='wyoBV'><tr id='wyoBV'><dt id='wyoBV'><q id='wyoBV'><span id='wyoBV'><b id='wyoBV'><form id='wyoBV'><ins id='wyoBV'></ins><ul id='wyoBV'></ul><sub id='wyoBV'></sub></form><legend id='wyoBV'></legend><bdo id='wyoBV'><pre id='wyoBV'><center id='wyoBV'></center></pre></bdo></b><th id='wyoBV'></th></span></q></dt></tr></i><div id='wyoBV'><tfoot id='wyoBV'></tfoot><dl id='wyoBV'><fieldset id='wyoBV'></fieldset></dl></div>

                • <bdo id='wyoBV'></bdo><ul id='wyoBV'></ul>
                  <tfoot id='wyoBV'></tfoot>
                • <legend id='wyoBV'><style id='wyoBV'><dir id='wyoBV'><q id='wyoBV'></q></dir></style></legend>

                  <small id='wyoBV'></small><noframes id='wyoBV'>

                • 本文介绍了php, mysqli-stmt.bind-param]:类型定义字符串中的元素数与绑定变量数不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                      // if the 'id' variable is not set in the URL, we must be creating a new record
                      else
                      {
                              // if the form's submit button is clicked, we need to process the form
                              if (isset($_POST['submit']))
                              {
                                      // get the form data
                  
                                              $mtcn = htmlentities($_POST['mtcn'], ENT_QUOTES);
                                              $amount = htmlentities($_POST['amount'], ENT_QUOTES);
                                              $currency = htmlentities($_POST['currency'], ENT_QUOTES);
                                              $sender_name = htmlentities($_POST['sender_name'], ENT_QUOTES);
                                              $sender_country = htmlentities($_POST['sender_country'], ENT_QUOTES);
                                              $receiver_name = htmlentities($_POST['receiver_name'], ENT_QUOTES);
                                              $comment = htmlentities($_POST['comment'], ENT_QUOTES);
                                              $support = htmlentities($_POST['support'], ENT_QUOTES);
                                              $email = htmlentities($_POST['email'], ENT_QUOTES);
                  
                                      // check that mtcn and amount  are both not empty
                                      if ($mtcn == '' || $amount == '')
                                      {
                                              // if they are empty, show an error message and display the form
                                              $error = 'ERROR: Please fill in all required fields!';
                                              renderForm($mtcn, $amount, $currency, $sender_name, $sender_country, $receiver_name, $comment, $support, $email, $error);
                                      }
                                      else
                                      {
                                              // insert the new record into the database
                                              if ($stmt = $mysqli->prepare("INSERT date (mtcn, amount, currency, sender_name, sender_country, receiver_name, comment, support, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"))
                                              {
                                                      $stmt->bind_param("ss", $mtcn, $amount, $currency, $sender_name, $sender_country, $receiver_name, $comment, $support, $email);
                                                      $stmt->execute();
                                                      $stmt->close();
                                              }
                                              // show an error if the query has an error
                                              else
                                              {
                                                      echo "ERROR: Could not prepare SQL statement.";
                                              }
                  
                                              // redirec the user
                                           //   header("Location: view.php");
                                      }
                  
                              }
                              // if the form hasn't been submitted yet, show the form
                              else
                              {
                                      renderForm();
                              }
                      }
                  
                      // close the mysqli connection
                      $mysqli->close();
                  

                  运行脚本时出现错误:

                  警告:mysqli_stmt::bind_param() [mysqli-stmt.bind-param]:数量类型定义字符串中的元素与绑定数不匹配C:wampwww ecords.php 中的变量在第 205 行

                  Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in C:wampwww ecords.php on line 205

                  警告:mysqli_stmt::execute() [mysqli-stmt.execute]: (HY000/2031):没有为准备好的语句中的参数提供数据C:wampwww ecords.php 第 206 行

                  Warning: mysqli_stmt::execute() [mysqli-stmt.execute]: (HY000/2031): No data supplied for parameters in prepared statement in C:wampwww ecords.php on line 206

                  知道如何修复它吗?我计算了来自 bind_param 的参数,它们对我来说似乎很好......

                  Any idea how I can fix it ? I counted the parameters from bind_param and they seem fine for me ...

                  推荐答案

                  我认为你需要更多的's'-es?

                  I think you need more 's'-es in this?

                   $stmt->bind_param("ss", $mtcn, $amount, $currency, $sender_name, $sender_country, $receiver_name, $comment, $support, $email);
                  

                  试试这个(假设它们都是字符串)

                  try this (asuming they're all strings)

                   $stmt->bind_param("sssssssss", $mtcn, $amount, $currency, $sender_name, $sender_country, $receiver_name, $comment, $support, $email);
                  

                  这篇关于php, mysqli-stmt.bind-param]:类型定义字符串中的元素数与绑定变量数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在非对象 MySQLi 上调用成员函数 bind_param() 下一篇:将其从 MySQL 更改为 MySQLi?

                  相关文章

                  最新文章

                  • <bdo id='FJ1pu'></bdo><ul id='FJ1pu'></ul>
                  <i id='FJ1pu'><tr id='FJ1pu'><dt id='FJ1pu'><q id='FJ1pu'><span id='FJ1pu'><b id='FJ1pu'><form id='FJ1pu'><ins id='FJ1pu'></ins><ul id='FJ1pu'></ul><sub id='FJ1pu'></sub></form><legend id='FJ1pu'></legend><bdo id='FJ1pu'><pre id='FJ1pu'><center id='FJ1pu'></center></pre></bdo></b><th id='FJ1pu'></th></span></q></dt></tr></i><div id='FJ1pu'><tfoot id='FJ1pu'></tfoot><dl id='FJ1pu'><fieldset id='FJ1pu'></fieldset></dl></div>

                  <small id='FJ1pu'></small><noframes id='FJ1pu'>

                      <tfoot id='FJ1pu'></tfoot><legend id='FJ1pu'><style id='FJ1pu'><dir id='FJ1pu'><q id='FJ1pu'></q></dir></style></legend>