• <bdo id='80vvE'></bdo><ul id='80vvE'></ul>

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

      2. <tfoot id='80vvE'></tfoot>

        <small id='80vvE'></small><noframes id='80vvE'>

      3. <legend id='80vvE'><style id='80vvE'><dir id='80vvE'><q id='80vvE'></q></dir></style></legend>

        MySQLi 相当于 mysql_result()?

        时间:2023-07-31
        <i id='kEUxI'><tr id='kEUxI'><dt id='kEUxI'><q id='kEUxI'><span id='kEUxI'><b id='kEUxI'><form id='kEUxI'><ins id='kEUxI'></ins><ul id='kEUxI'></ul><sub id='kEUxI'></sub></form><legend id='kEUxI'></legend><bdo id='kEUxI'><pre id='kEUxI'><center id='kEUxI'></center></pre></bdo></b><th id='kEUxI'></th></span></q></dt></tr></i><div id='kEUxI'><tfoot id='kEUxI'></tfoot><dl id='kEUxI'><fieldset id='kEUxI'></fieldset></dl></div>

                  <tbody id='kEUxI'></tbody>
                <legend id='kEUxI'><style id='kEUxI'><dir id='kEUxI'><q id='kEUxI'></q></dir></style></legend>

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

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

                • <tfoot id='kEUxI'></tfoot>
                  本文介绍了MySQLi 相当于 mysql_result()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在将一些旧的 PHP 代码从 mysql 移植到 MySQLi,但我遇到了一个小问题.

                  I'm porting some old PHP code from mysql to MySQLi, and I've ran into a minor snag.

                  有没有相当于旧的mysql_result()函数?

                  Is there no equivalent to the old mysql_result() function?

                  我知道 mysql_result() 在处理多于 1 行时比其他函数慢,但很多时候我只有 1 个结果和 1 个字段.使用它可以让我将 4 行压缩成 1 行.

                  I know mysql_result() is slower than the other functions when you're working with more than 1 row, but a lot of the time I have only 1 result and 1 field. Using it lets me condense 4 lines into 1.

                  旧代码:

                  if ($r && mysql_num_rows($r))  
                      $blarg = mysql_result($r, 0, 'blah');
                  

                  所需代码:

                  if ($r && $r->num_rows)  
                      $blarg = $r->result(0, 'blah');
                  

                  但是没有这样的事情.:(

                  But there is no such thing. :(

                  有什么我遗漏的吗?或者我将不得不把它搞砸并制作一切:

                  Is there something I'm missing? Or am I going to have to suck it up and make everything:

                  if ($r && $r->num_rows)  
                  {  
                      $row = $r->fetch_assoc();  
                      $blarg = $row['blah'];  
                  }
                  

                  推荐答案

                  PHP 5.4 现在支持 函数数组解引用,这意味着您可以这样做:

                  PHP 5.4 now supports function array dereferencing, which means you can do this:

                  if ($r && $r->num_rows)  
                  {  
                      $row = $r->fetch_assoc()['blah'];  
                  }
                  

                  这篇关于MySQLi 相当于 mysql_result()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么我不能运行两个 mysqli 查询?第二个失败 下一篇:严格的标准:mysqli_multi_query 的 mysqli_next_result() 错

                  相关文章

                  最新文章

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

                  1. <tfoot id='glxIF'></tfoot>

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

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