久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='CczYd'></tfoot>
    1. <legend id='CczYd'><style id='CczYd'><dir id='CczYd'><q id='CczYd'></q></dir></style></legend>

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

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

        mysqli_stmt::bind_result(): 綁定變量的數量與 PHP 中準

        mysqli_stmt::bind_result(): Number of bind variables doesn#39;t match number of fields in prepared statement in PHP(mysqli_stmt::bind_result(): 綁定變量的數量與 PHP 中準備好的語句中的字段數量不匹配) - IT屋-程序員軟
        <legend id='cIOqq'><style id='cIOqq'><dir id='cIOqq'><q id='cIOqq'></q></dir></style></legend>
        <i id='cIOqq'><tr id='cIOqq'><dt id='cIOqq'><q id='cIOqq'><span id='cIOqq'><b id='cIOqq'><form id='cIOqq'><ins id='cIOqq'></ins><ul id='cIOqq'></ul><sub id='cIOqq'></sub></form><legend id='cIOqq'></legend><bdo id='cIOqq'><pre id='cIOqq'><center id='cIOqq'></center></pre></bdo></b><th id='cIOqq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cIOqq'><tfoot id='cIOqq'></tfoot><dl id='cIOqq'><fieldset id='cIOqq'></fieldset></dl></div>
          • <bdo id='cIOqq'></bdo><ul id='cIOqq'></ul>

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

                • <tfoot id='cIOqq'></tfoot>

                    <tbody id='cIOqq'></tbody>

                  本文介紹了mysqli_stmt::bind_result(): 綁定變量的數量與 PHP 中準備好的語句中的字段數量不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試進行用戶名搜索 [我似乎已經完成并正在工作] 但是當您搜索用戶名時,會顯示有關該帳戶的信息.比如我搜索了virtualAnon,他的名字和first_name等信息就會出現在他的用戶名后面.

                  I am trying to do a username search [which I seemingly finished and working as well] but when you've searched for the username, the information about the account will show up. For example, I've searched for virtualAnon, his name and information such as first_name will show up after his username.

                  我試圖通過替換 $query = "SELECT username FROM users WHERE username like 來修復它?LIMIT 1"; to $query = "SELECT * FROM users WHERE username like ?LIMIT 1"; 但在我嘗試之后,錯誤

                  I've tried to fix it by replacing $query = "SELECT username FROM users WHERE username like ? LIMIT 1"; to $query = "SELECT * FROM users WHERE username like ? LIMIT 1"; but after I've tried that, the error

                  mysqli_stmt::bind_result(): 綁定變量數量不匹配PHP中準備好的語句中的字段數

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

                  出現.

                  這是用于獲取用戶名和數據庫的 PHP 文件:

                  <?php
                      if($_GET['keyword'] && !empty($_GET['keyword']))
                      {
                          $conn = mysqli_connect('localhost','root','','loginsecure'); //Connection to my database
                          $keyword = $_GET['keyword'];
                          $search = $_GET['keyword'];
                          $keyword="%$keyword%";
                          $query = "SELECT * FROM users WHERE username like ? LIMIT 1";
                          # When I tried to SELECT *, It gives me the error of: Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in ...fetch.php on line 22
                          $statement = $conn->prepare($query);
                          $statement->bind_param('s',$keyword);
                          $statement->execute();
                          $statement->store_result();
                          if($statement->num_rows() == 0) // so if we have 0 records acc. to keyword display no records found
                          {
                              echo '<div id="item">Sorry, but there is no user "'.$search.'" found in our database :(</div>';
                              $statement->close();
                              $conn->close();
                  
                          }
                          else {
                              $statement->bind_result($name); # There is a error i'm encountering when I try to Select * from the line 8.
                              while ($statement->fetch()) //outputs the records
                              {
                                  echo "<div id='item'><a href="../user/username.php?username=$name">$name</a></div>";
                                  # It supposed to show more information about the user, by using $name['first_name'] or $name['last_name']
                              };
                              $statement->close();
                              $conn->close();
                          };
                      };
                  ?>
                  

                  推薦答案

                  您遇到的問題是 mysqli_stmt::bind_result 將嘗試將結果集中的每一列綁定到一個變量.這意味著您需要與列相同數量的變量.如果有兩列返回,則需要將它們綁定到兩個變量.

                  The problem that you're getting is that mysqli_stmt::bind_result will try to bind each column in the result set to a variable. Which means that you need the same amount of variables as you've got columns. If you've got two columns being returned, you need to bind them to two variables.

                  $statement->bind_result($name);中,你是說只有一列,所以將它綁定到$name" 而您的查詢(SELECT * FROM users WHERE username like ? LIMIT 1)正在獲取該表的所有列.

                  In $statement->bind_result($name);, you're saying "There's only going to be one column, so bind it to $name" whereas your query (SELECT * FROM users WHERE username like ? LIMIT 1) is fetching all the columns for that table.

                  所以解決方案是在這個實例中只選擇你想要的單數列.替換

                  So the solution is to only select the singular column you want in this instance. Replace

                  SELECT name 
                  

                  SELECT *
                  

                  這篇關于mysqli_stmt::bind_result(): 綁定變量的數量與 PHP 中準備好的語句中的字段數量不匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)

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

                      • <i id='ScRok'><tr id='ScRok'><dt id='ScRok'><q id='ScRok'><span id='ScRok'><b id='ScRok'><form id='ScRok'><ins id='ScRok'></ins><ul id='ScRok'></ul><sub id='ScRok'></sub></form><legend id='ScRok'></legend><bdo id='ScRok'><pre id='ScRok'><center id='ScRok'></center></pre></bdo></b><th id='ScRok'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ScRok'><tfoot id='ScRok'></tfoot><dl id='ScRok'><fieldset id='ScRok'></fieldset></dl></div>
                      • <legend id='ScRok'><style id='ScRok'><dir id='ScRok'><q id='ScRok'></q></dir></style></legend>
                            <tbody id='ScRok'></tbody>
                        1. <tfoot id='ScRok'></tfoot>
                            <bdo id='ScRok'></bdo><ul id='ScRok'></ul>

                            主站蜘蛛池模板: 精品国产一区二区三区性色 | 欧美一a一片一级一片 | 国产97人人超碰caoprom | 成人国产精品视频 | 男人的天堂在线视频 | 精品日韩一区二区三区 | 在线免费观看欧美 | 国产精品视频 | 日本在线免费视频 | 亚洲国产成人精品女人久久久 | 国产亚洲黄色片 | 久草热8精品视频在线观看 午夜伦4480yy私人影院 | 国产精品免费一区二区三区四区 | 日本黄色片免费在线观看 | 国产资源一区二区三区 | 国产精品久久久久久婷婷天堂 | 国产精品综合一区二区 | 日韩字幕一区 | www.免费看片.com | 久久精品久久久久久 | 激情自拍偷拍 | 国产99久久 | 欧美aaa| 国产精品一区久久久 | 91精品久久久久久久久中文字幕 | 亚洲精品久久久 | 精品久久久久久 | 成人在线电影在线观看 | 国产你懂的在线观看 | 午夜理伦三级理论三级在线观看 | 在线观看国产视频 | 久久久精品视频免费看 | 色接久久 | 国内精品久久久久久久影视简单 | 99精品免费久久久久久日本 | 国产精品成人国产乱一区 | 成人亚洲| 涩涩鲁亚洲精品一区二区 | 正在播放国产精品 | 成人黄色网址大全 | 欧美一级欧美三级在线观看 |