• <legend id='OMtg9'><style id='OMtg9'><dir id='OMtg9'><q id='OMtg9'></q></dir></style></legend>

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

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

        <tfoot id='OMtg9'></tfoot>

        mysql 中的 store_result() 和 get_result() 返回 false

        时间:2023-07-31
          <tbody id='6ZC9c'></tbody>
          <bdo id='6ZC9c'></bdo><ul id='6ZC9c'></ul>

          1. <tfoot id='6ZC9c'></tfoot>

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

              <small id='6ZC9c'></small><noframes id='6ZC9c'>

              • <legend id='6ZC9c'><style id='6ZC9c'><dir id='6ZC9c'><q id='6ZC9c'></q></dir></style></legend>

                • 本文介绍了mysql 中的 store_result() 和 get_result() 返回 false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  几天前我做了一个代码,包括 get_result() 来从我的数据库中接收结果.今天我想添加它并修复一些错误.所以我尝试使用 num_rows 来查看是否有任何返回.但为此我不得不使用 store_result().当我这样做时,get_result() 只返回一个布尔值 false.当我注释掉 store_result() 时,一切正常.我知道 >= 会搞砸.但我把 = 放在那里进行调试(注释掉 store_result() 并查看发生了什么).所以这不是问题

                  I made a code a few days ago including get_result() to receave the results from my database. Today I wantet to add to it and fix some errors. So I tried to use num_rows to see if anything were returned. But for this I had to use store_result(). And when I do this get_result() just returns a boolean of false. When I comment out store_result() everything works as it should. I know that the >= will mess it up. But I put the = there for debugging(to comment out the store_result() and see what happend). So that is not the problem

                  $sql = $this->connect();
                  $a = $sql->prepare("SELECT `name`, `title`, `comment`, `date`  FROM `comment` WHERE `post`=?");
                  $a->bind_param("s", $id);
                  $a->execute();
                  $a->store_result();
                  if ($a->num_rows >= 0) {
                      $res = $a->get_result();
                      var_dump($res);
                  
                      while ($row = $res->fetch_assoc()) {
                          $results[] = $row;
                      }
                      return $results;
                  } else {
                      return false;
                  }
                  

                  推荐答案

                  使用 get_result() 代替 store_result(),然后使用结果对象的 num_rows:

                  Use get_result() instead of store_result(), and then use the result object's num_rows:

                  $a->execute();
                  $res = $a->get_result();
                  if ($res->num_rows > 0) {
                      while ($row = $res->fetch_assoc()) {
                          $results[] = $row;
                      }
                      return $results;
                  } else {
                      return false;
                  }
                  

                  这篇关于mysql 中的 store_result() 和 get_result() 返回 false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:调用未定义的函数 mysqli_result::num_rows() 下一篇:没有了

                  相关文章

                  最新文章

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

                    <tfoot id='TLXaB'></tfoot>
                  1. <small id='TLXaB'></small><noframes id='TLXaB'>

                        <bdo id='TLXaB'></bdo><ul id='TLXaB'></ul>

                    1. <legend id='TLXaB'><style id='TLXaB'><dir id='TLXaB'><q id='TLXaB'></q></dir></style></legend>