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

    1. <tfoot id='QeKPj'></tfoot>
        <bdo id='QeKPj'></bdo><ul id='QeKPj'></ul>

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

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

        MySQLi num_rows 返回 0

        时间:2023-09-24

            <tfoot id='6kP30'></tfoot>
            <legend id='6kP30'><style id='6kP30'><dir id='6kP30'><q id='6kP30'></q></dir></style></legend>
              <bdo id='6kP30'></bdo><ul id='6kP30'></ul>

            • <small id='6kP30'></small><noframes id='6kP30'>

              <i id='6kP30'><tr id='6kP30'><dt id='6kP30'><q id='6kP30'><span id='6kP30'><b id='6kP30'><form id='6kP30'><ins id='6kP30'></ins><ul id='6kP30'></ul><sub id='6kP30'></sub></form><legend id='6kP30'></legend><bdo id='6kP30'><pre id='6kP30'><center id='6kP30'></center></pre></bdo></b><th id='6kP30'></th></span></q></dt></tr></i><div id='6kP30'><tfoot id='6kP30'></tfoot><dl id='6kP30'><fieldset id='6kP30'></fieldset></dl></div>
                  <tbody id='6kP30'></tbody>
                1. 本文介绍了MySQLi num_rows 返回 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是我的代码

                  $stmt = $conn->mysqli->stmt_init();
                  $stmt = $conn->mysqli->prepare('SELECT Username, EmailVerified, Blocked FROM user WHERE Email = ? AND SLANumber = ? AND Password = ?');
                  $stmt->bind_param('ssb', $_POST['EmailID'], $_POST['SLANumber'], $_POST['Password']);
                  $stmt->execute();
                  $stmt->store_result();
                  $result = $stmt->get_result();
                  if($result->num_rows == 0){
                      echo 'No rows found';
                  }
                  else{
                      // Continue processing here
                      .....
                  }
                  

                  代码总是回显No rows found.一两天前,它工作正常.

                  The code always echoes No rows found. A day or two before, it was working fine.

                  正如预期的那样,直接运行查询会得到想要的结果.

                  As expected, running the query directly gives the desired result.

                  代码有什么问题?

                  推荐答案

                  num_rowsmysqli_stmt 的属性,而不是结果资源的属性.所以你应该这样做:

                  num_rows is a property of mysqli_stmt, not of a result resource. So you should be doing:

                  $result = $stmt->get_result();
                  
                  // Also check strict comparison against int 0,
                  // to avoid incorrect equality with boolean FALSE
                  if($stmt->num_rows === 0){
                      echo 'No rows found';
                  }
                  

                  这篇关于MySQLi num_rows 返回 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:过滤结果时是否有更短的方法来设置查询? 下一篇:PHP 代码 (mysqli) 查询在特定代码后不起作用

                  相关文章

                  最新文章

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

                    <tfoot id='m6ele'></tfoot>
                      <bdo id='m6ele'></bdo><ul id='m6ele'></ul>
                  2. <legend id='m6ele'><style id='m6ele'><dir id='m6ele'><q id='m6ele'></q></dir></style></legend>
                    1. <small id='m6ele'></small><noframes id='m6ele'>