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

    1. <small id='Uj6RV'></small><noframes id='Uj6RV'>

        mysqli_stmt_bind_param():变量数与绑定参数中准备好的

        时间:2023-09-25
          <tbody id='fzv60'></tbody>
        <i id='fzv60'><tr id='fzv60'><dt id='fzv60'><q id='fzv60'><span id='fzv60'><b id='fzv60'><form id='fzv60'><ins id='fzv60'></ins><ul id='fzv60'></ul><sub id='fzv60'></sub></form><legend id='fzv60'></legend><bdo id='fzv60'><pre id='fzv60'><center id='fzv60'></center></pre></bdo></b><th id='fzv60'></th></span></q></dt></tr></i><div id='fzv60'><tfoot id='fzv60'></tfoot><dl id='fzv60'><fieldset id='fzv60'></fieldset></dl></div>

      1. <small id='fzv60'></small><noframes id='fzv60'>

          <tfoot id='fzv60'></tfoot>
            <bdo id='fzv60'></bdo><ul id='fzv60'></ul>

              <legend id='fzv60'><style id='fzv60'><dir id='fzv60'><q id='fzv60'></q></dir></style></legend>
                1. 本文介绍了mysqli_stmt_bind_param():变量数与绑定参数中准备好的语句中的参数数不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我收到此错误.我想注册到页面.mysqli_stmt_bind_param():变量数与绑定参数中准备好的语句中的参数数不匹配.`

                  I am getting this error.i wanna register to page. mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in bind param. `

                  <?php       if(isset($_POST['submit'])) { // Was the form submitted?
                          $link = mysqli_connect("localhost", "root", "", "databaseInitialization") or die ("Connection Error " . mysqli_error($link));
                              $sql = "INSERT INTO user(first_name, last_name, email, password, bio, location, industry,salt) VALUES(?,?,?,?,?,?,?,?)"; 
                              if ($stmt = mysqli_prepare($link, $sql)) {
                                  $fname = $_POST['fname'];
                                  $lname = $_POST['lname'];
                                  $email = $_POST['email'];
                                  $_SESSION['email'] = $email;
                                  $bio = $_POST['bio'];
                  
                                  $location = $_POST['location'];
                                  $industry = $_POST['industry'];
                                          $salt = mt_rand();
                                  $password = password_hash($salt.$_POST['pass'], PASSWORD_BCRYPT)  or die("bind param");
                                  //echo "before bind";
                                  mysqli_stmt_bind_param($stmt, 'sssssss', $fname, $lname, $password, $email, $bio, $location, $industry) or die("bind param");
                                  //echo "after bind";
                  
                  
                      if(mysqli_stmt_execute($stmt)) {
                                            echo "<h4><b><center>Success</center></b></h4>";
                              //this redirects to user.php - but still need to log in 
                              header('location: user.php');
                                  } else {
                                      echo "<h4><b><center>Failed</center></b></h4>";
                                      printf("<b><center>Error: %s</center></b>.
                  ", mysqli_stmt_error($stmt));
                                  }
                              $result = mysqli_stmt_get_result($stmt);
                              }
                          } 
                          else { ?>`
                  

                  推荐答案

                  在你的插入中,有 8 列,只有 7 个绑定

                  In your insert, are 8 columns and only 7 binds

                                       1           2        3      4        5      6
                  INSERT INTO user(first_name, last_name, email, password, bio, location, 
                     7       8
                  industry,salt)
                  VALUES(?,?,?,?,?,?,?,?)
                         1 2 3 4 5 6 7 8
                  

                  绑定,缺少一个,可能是salt

                  The binds, is missing one, propably the salt

                                                 1234567 
                  mysqli_stmt_bind_param($stmt, 'sssssss',
                     1      2        3         4       5      6          7
                  $fname, $lname, $password, $email, $bio, $location, $industry) or die("bind param");
                  

                  s,列和变量的数量必须相同,在这种情况下为 8.要修复只需添加一个 s$saltbind_param(),像这样:

                  the numbers of s, columns and variables must be the same, in this case 8. To fix just add one s and $salt at bind_param(), like this:

                  mysqli_stmt_bind_param($stmt, 'ssssssss', $fname, $lname, $password, $email, $bio, $location, $industry, $salt) or die("bind param");
                  

                  这篇关于mysqli_stmt_bind_param():变量数与绑定参数中准备好的语句中的参数数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 cPanel 管理的服务器上安装 MySQLi? 下一篇:MySQLi - 在 bind_param 之后声明变量?

                  相关文章

                  最新文章

                      <bdo id='NqcSV'></bdo><ul id='NqcSV'></ul>
                  1. <small id='NqcSV'></small><noframes id='NqcSV'>

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

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