Why you should not use mysql_fetch_assoc more than 1 time?

后端 未结 4 1064
梦毁少年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 19:55

    When someone says you can't call mysql_fetch_assoc() twice, they mean against the same resource. The resource result you pass in to mysql_fetch_assoc() is done by reference. You'll need to reset the position of the pointer before you can use mysql_fetch_assoc() a second time.

    EDIT: And to do so, try using mysql_data_seek().

提交回复
热议问题