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

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

      mysqli_fetch_array 只返回一个结果

      时间:2023-07-31
    3. <tfoot id='Kw4t7'></tfoot>
          <tbody id='Kw4t7'></tbody>

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

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

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

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

              1. 本文介绍了mysqli_fetch_array 只返回一个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试使用以下代码(在 $host 中使用适当的值等)对小型 mysql 数据库进行非常非常简单的查询:

                I'm trying to make a very, very simple query of a small mysql database, using the following code (with appropriate values in $host, etc.):

                $result = mysqli_query($connection, "select university from universities_alpha");
                $row = mysqli_fetch_array($result);
                
                echo print_r($result);
                echo '<br><br>';
                echo print_r($row);
                

                如您所见,我以人类可读的方式打印了结果,结果是:

                As you can see, I printed out the results in a human-readable way, yielding:

                mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => Array ( [0] => 19 ) [num_rows] => 9 [type] => 0 ) 1
                
                Array ( [0] => Arizona State Univ. [university] => Arizona State Univ. ) 1
                

                该专栏中有一些示例大学,所以我不确定我做错了什么.

                There are a few example universities in that column, so I'm not sure what I'm doing wrong.

                推荐答案

                mysqli_fetch_array 每次调用时都通过指针工作

                mysqli_fetch_array works by pointers each time it's called

                想象以下内容

                $result = mysqli_query($connection, "select university from universities_alpha");
                $row = mysqli_fetch_array($result); // this is the first row
                $row = mysqli_fetch_array($result); // now it's the second row
                $row = mysqli_fetch_array($result); // third row
                

                要以您想要的方式实际显示数据,我建议您执行以下操作

                To actually display the data the way you want it to, I suggest you do the following

                $rows = array();
                $result = mysqli_query($connection, "select university from universities_alpha");
                while($row = mysqli_fetch_array($result)) {
                    $rows[] = $row;
                }
                
                print_r($rows);
                

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

                上一篇:PHP MySQLi 多次插入 下一篇:PHP 准备好的语句问题

                相关文章

                最新文章

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

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

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