Use query twice mysql_fetch_array

后端 未结 5 1879
忘了有多久
忘了有多久 2020-12-29 06:06

a simple

$stuff = mysql_query(\"SELECT * FROM users\");

while($s = mysql_fetch_array($stuff)){
# ....
}

while($r = mysql_fetch_array($stuff)){
# ...
}
         


        
5条回答
  •  [愿得一人]
    2020-12-29 06:39

    see the docs

    I guess it's because

    Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.

    I think moving data pointer with mysql_data_seek() would do the job But i think this is not a good way, you should usually fetch data from database once and store them

提交回复
热议问题