Use query twice mysql_fetch_array

后端 未结 5 1786
忘了有多久
忘了有多久 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:26

    If you user "foreach" instead of "while" you'll not have any problem and no need to mysqli_seek_data() :

    //1st loop :
    foreach($stuff as $row)
    {
       echo $row['...'];
    }
    ...
    //2nd loop :
    foreach($stuff as $row)
    {
       echo $row['...'];
    }
    

提交回复
热议问题