Why you should not use mysql_fetch_assoc more than 1 time?

后端 未结 4 1048
梦毁少年i
梦毁少年i 2020-12-20 19:09

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

e.g.: I want to display two tables one with users who paid for mem

4条回答
  •  [愿得一人]
    2020-12-20 20:15

    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.

提交回复
热议问题