• <bdo id='kHGKm'></bdo><ul id='kHGKm'></ul>
  • <small id='kHGKm'></small><noframes id='kHGKm'>

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

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

        为什么你不应该使用 mysql_fetch_assoc 超过 1 次?

        时间:2023-10-12

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

        • <legend id='HH0uf'><style id='HH0uf'><dir id='HH0uf'><q id='HH0uf'></q></dir></style></legend>
            <tbody id='HH0uf'></tbody>
          <tfoot id='HH0uf'></tfoot>

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

                  本文介绍了为什么你不应该使用 mysql_fetch_assoc 超过 1 次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有人说你不应该多次使用mysql_fetch_assoc,这是为什么呢?

                  Some people say you should not use mysql_fetch_assoc more than one time, why is that?

                  例如:我想显示两张表,一张是支付会员费的用户,另一张是没有支付会员费的用户,所以我不是查询数据库两次,而是查询一次并获得 $result 变量使用这两种类型的用户,然后我运行循环 mysql_fetch_assoc 并查看 list['membership'] = 'paid' 然后 echo ...

                  e.g.: I want to display two tables one with users who paid for membership, other with users who did not, so instead of querying database 2 times I query it one time and get $result variable with both types of users then I run loop mysql_fetch_assoc and see if list['membership'] = 'paid' then echo ...

                  第二次我循环 mysql_fetch_assoc 并查看 list['membership'] = 'free' 然后 echo ...

                  Second time I loop loop mysql_fetch_assoc and see if list['membership'] = 'free' then echo ...

                  考虑到注册和未注册的用户数量大致相等,什么使用更少的资源.

                  What uses less resources considering I got about equal amount of users who registered and unregistered.

                  推荐答案

                  把你的查询结果集想象成一根香肠,把 mysql_fetch_assoc() 想象成一把切下那根香肠的刀.每次取一行时,都会切下另一根香肠,而且总是新的一根香肠.你不能去切掉之前切过的一块,因为它已经被吃掉了.

                  Think of your query result set as a sausage, and mysql_fetch_assoc() as a knife that slices off a piece of that sausage. Every time you fetch a row, another piece of sausage is cut off, and it's always a NEW piece of sausage. You can't go and cut off a previously cut piece, because it's been eaten already.

                  这篇关于为什么你不应该使用 mysql_fetch_assoc 超过 1 次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何将 POST 数据传递给 PHP-CGI? 下一篇:请求源

                  相关文章

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

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

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

                      <bdo id='wDa6Q'></bdo><ul id='wDa6Q'></ul>
                      <legend id='wDa6Q'><style id='wDa6Q'><dir id='wDa6Q'><q id='wDa6Q'></q></dir></style></legend>