• <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 次?

        Why you should not use mysql_fetch_assoc more than 1 time?(为什么你不应该使用 mysql_fetch_assoc 超过 1 次?)

        <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 次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)

                    • <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>
                          <tbody id='wDa6Q'></tbody>

                      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>