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

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

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

        mysqli 查询结果显示所有行

        时间:2023-07-31
          <bdo id='9r0Nk'></bdo><ul id='9r0Nk'></ul>

                <legend id='9r0Nk'><style id='9r0Nk'><dir id='9r0Nk'><q id='9r0Nk'></q></dir></style></legend>

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

                  <small id='9r0Nk'></small><noframes id='9r0Nk'>

                  本文介绍了mysqli 查询结果显示所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有以下代码:

                  include $_SERVER['DOCUMENT_ROOT'].'/include/conn.php'; 
                  
                  $query = "SELECT title FROM news_event";
                  $result = $mysqli->query($query);
                  $row = $result->fetch_array(MYSQLI_BOTH);
                  $row_cnt = $result->num_rows;
                  $result->free();
                  $mysqli->close();
                  

                  如果只有一个结果,这很好,因为我可以只回显 $row['title'] 但如果有很多结果,我如何让它循环并打印每个排?

                  This is fine if there is only one result as I can just echo $row['title'] but if there are lots of results, how do I get this to loop through and print every row?

                  我确定这真的很简单,但我不确定我需要在 Google 中搜索什么.

                  I'm sure this is really simple but I'm just not sure what I need to search for in Google.

                  我正在寻找与此等效的 mysqli:

                  I'm looking for a mysqli equivalent of this:

                  while( $row = mysql_fetch_array($result) )
                  {
                      echo $row['FirstName'] . " " . $row['LastName'];
                      echo "<br />";
                  }
                  

                  推荐答案

                  只需将其替换为 mysqli_fetch_arraymysqli_result::fetch_array :)

                  Just replace it with mysqli_fetch_array or mysqli_result::fetch_array :)

                  while( $row = $result->fetch_array() )
                  {
                      echo $row['FirstName'] . " " . $row['LastName'];
                      echo "<br />";
                  }
                  

                  几乎所有的mysql_*函数都有对应的mysqli_*函数.

                  Almost all mysql_* functions have a corresponding mysqli_* function.

                  这篇关于mysqli 查询结果显示所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何从准备好的语句中获取 assoc 数组中的所有内 下一篇:MySQLi 中的 SELECT * FROM

                  相关文章

                  最新文章

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

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

                    2. <small id='Y2HdN'></small><noframes id='Y2HdN'>

                      <legend id='Y2HdN'><style id='Y2HdN'><dir id='Y2HdN'><q id='Y2HdN'></q></dir></style></legend>