久久久久久久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(): 綁定變量的數(shù)量與 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(): 綁定變量的數(shù)量與 PHP 中準備好的語句中的字段數(shù)量不匹配) - 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(): 綁定變量的數(shù)量與 PHP 中準備好的語句中的字段數(shù)量不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

                  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(): 綁定變量數(shù)量不匹配PHP中準備好的語句中的字段數(shù)

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

                  出現(xiàn).

                  這是用于獲取用戶名和數(shù)據(jù)庫的 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 將嘗試將結(jié)果集中的每一列綁定到一個變量.這意味著您需要與列相同數(shù)量的變量.如果有兩列返回,則需要將它們綁定到兩個變量.

                  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.

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

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

                  SELECT name 
                  

                  SELECT *
                  

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

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

                  相關(guān)文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調(diào)用未定義的函數(shù) mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結(jié)果)
                  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>

                            主站蜘蛛池模板: 国产精品高清在线 | 精品国产乱码久久久久久丨区2区 | 日韩欧美一区二区三区免费观看 | 久久成人免费视频 | 成人小视频在线观看 | 亚洲国产精品日韩av不卡在线 | 精品一区二区免费视频 | 国产精品久久久久久影视 | 日韩免费网站 | 久久国产精品免费视频 | 韩日精品一区 | 久久精品免费 | 精品视频一区二区三区在线观看 | 久久久久久久久久久久亚洲 | 剑来高清在线观看 | 欧美日韩精品 | 精品99久久久久久 | 国产999精品久久久 日本视频一区二区三区 | 一本色道精品久久一区二区三区 | 中文字幕一区二区三区精彩视频 | 伊人伊人网 | 久久久久久毛片免费观看 | 免费的一级视频 | 日本黄色免费视频 | 日韩成人在线播放 | 国产一区二区自拍 | 99r在线| 久久国品片 | 自拍偷拍亚洲一区 | 国产成人精品一区二区三区网站观看 | 日本久久福利 | 2020国产在线| 色呦呦网站 | 五月天激情综合网 | 亚洲精品久久久久久久不卡四虎 | 国产欧美精品区一区二区三区 | 九九亚洲 | 中文字幕免费在线观看 | 亚洲成人免费在线 | 欧美一区二区三区在线观看视频 | www.99精品|