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

        <tfoot id='CQoK6'></tfoot>

      1. <legend id='CQoK6'><style id='CQoK6'><dir id='CQoK6'><q id='CQoK6'></q></dir></style></legend>
        • <bdo id='CQoK6'></bdo><ul id='CQoK6'></ul>

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

      2. mysqli_num_rows() 期望参数 1 是 mysqli_result,对象

        时间:2023-07-29
        <tfoot id='qKNOa'></tfoot>
          1. <small id='qKNOa'></small><noframes id='qKNOa'>

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

                • <bdo id='qKNOa'></bdo><ul id='qKNOa'></ul>
                • <legend id='qKNOa'><style id='qKNOa'><dir id='qKNOa'><q id='qKNOa'></q></dir></style></legend>
                • 本文介绍了mysqli_num_rows() 期望参数 1 是 mysqli_result,对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是我第一次使用mysqli.它似乎在 mysqli_num_rows() 中的括号之间寻找结果集的名称.然而,当我尝试 $stmt、$conn 和什么都没有时,我得到了同样的错误.令人沮丧!下面最后一行中的 $WHAT 是什么?

                  This is my first experience with mysqli. It seems to be looking for the name of a result set in between the parentheses in mysqli_num_rows(). Yet when I tried $stmt, $conn, and nothing, I got the same error. Frustrating! What goes where $WHAT is in the last line below?

                  或者我尝试的方式不对.我想要做的就是检查是否返回了结果.我真的不需要行数.我应该只做一个带有错误消息的 else 语句吗?这是最好的方法吗?是否有一种编写函数来连接和接受查询及其参数的好方法?我为 mysql 写了一个,但这太不同了!我不期待重写几十个查询!

                  Or maybe I'm trying the wrong tack. All I want to do is check that a result was returned. I don't really need the number of rows. Should I just do an else statement with an error message? Is that the best way to do it? And is there a good way to write a function to connect and accept the query and it's parameters? I wrote one for mysql but this is so different! I'm not looking forward to rewriting dozens of queries!

                  $conn = mysqli_connect($host, $user, $pwd, $db,$port=$port_nbr); 
                  
                  if ($mysqli_connect_errno) {
                      printf("Connect failed: %s
                  ",
                      mysqli_connect_error());
                      exit;
                  }
                  if($stmt=$conn->prepare("SELECT id, name, status, type FROM organization")) {
                      $stmt->execute();
                      $stmt->bind_result($org_id, $orgname, $orgstatus, $orgtype);    
                      $num=mysqli_num_rows($WHAT);
                  }
                  

                  推荐答案

                  当您只想要面向对象时,您正在结合面向过程和面向对象的方法.改变

                  You're combining procedural and object oriented approaches, when you only want object oriented. Change

                  $num=mysqli_num_rows($WHAT);
                  

                  $num = $stmt->num_rows();
                  

                  这篇关于mysqli_num_rows() 期望参数 1 是 mysqli_result,对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MYSQLi bind_result 返回 null 下一篇:扩展 mysqli_result

                  相关文章

                  最新文章

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

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

                  2. <legend id='I2i1m'><style id='I2i1m'><dir id='I2i1m'><q id='I2i1m'></q></dir></style></legend>

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