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

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

        • <bdo id='WYnlQ'></bdo><ul id='WYnlQ'></ul>

        mysqli_num_rows 返回 1 无论如何

        时间:2023-07-29
          <bdo id='E0lFA'></bdo><ul id='E0lFA'></ul>

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

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

            • <legend id='E0lFA'><style id='E0lFA'><dir id='E0lFA'><q id='E0lFA'></q></dir></style></legend>
                  <tbody id='E0lFA'></tbody>
                  本文介绍了mysqli_num_rows 返回 1 无论如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当我在 phpMyAdmin 中进行 SQL 搜索(用变量代替实际值)时,它返回正确的行号,但是当使用 PHP 返回这个值时,无论如何它总是返回 1.提前致谢.

                  When I do a SQL search in phpMyAdmin (substituting the variable for the actual value) it returns the correct row number but when using PHP to return this value it always returns 1 no matter what. Thanks in advance.

                  function user_exists($username) {
                      $link = mysqli_connect('localhost','root','','test');
                      $username = sanitize($username);
                      $query = mysqli_query($link, "SELECT COUNT(`user_id`) FROM `new_base` WHERE `username`='$username'");
                      $row_cnt = mysqli_num_rows($query);
                      echo $row_cnt;
                      mysqli_free_result($query);
                      mysqli_close($link);
                  }
                  

                  推荐答案

                  当你使用 COUNT(*)即使计数为零也总是返回一行.

                  你要么:

                  1. 想去掉count(*)然后使用mysqli_num_rows()
                  2. 获取count(*)
                  3. 的结果
                  1. Want to remove the count(*) and then use mysqli_num_rows() or
                  2. Get the result of count(*)

                  .

                  $row = mysqli_fetch_assoc($query);
                  echo $row['COUNT(`user_id`)'];
                  

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

                  上一篇:无法将内爆数组绑定到 mysql 准备好的语句中 下一篇:mysqli 插入 - 但前提是不重复

                  相关文章

                  最新文章

                  <tfoot id='sCvdT'></tfoot>
                    <bdo id='sCvdT'></bdo><ul id='sCvdT'></ul>

                  1. <legend id='sCvdT'><style id='sCvdT'><dir id='sCvdT'><q id='sCvdT'></q></dir></style></legend>
                  2. <small id='sCvdT'></small><noframes id='sCvdT'>

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