$rs=mysql_query("select * from user");
if (mysql_num_rows($rs)>=1){
while ($rsa=mysql_fetch_array($rs)){
echo "11111111111</br>";         ///////////////这里可以执行

}         /////我想在这里用$rsa->movefirst();但是没有这个函数 while ($rsa=mysql_fetch_row($rs)){
echo "22222222</br>";     ///////////////这里执行不到

}
}
如果我想进入第二个while ,该如何写了?
就是说,我从头到尾读取了一次表记录,我还想再读取一边该如何写?

解决方案 »

  1.   

    想在这里用的$rsa->movefirst()是干什么的?
    跳过第一条?
    再读取一遍这种需求很奇怪  说说你到底想干嘛 在读一遍不是没有办法 但是一般需求用不到  
      

  2.   

    $rsa->movefirst()
    就是移动到记录集的第一条,以便第二个while的条件不为false
    while ($rsa=mysql_fetch_row($rs)){
      

  3.   

    mysql_data_seek ($rs , 0);//第二个循环前面执行
      

  4.   

      算了 虽然感觉很奇怪  $rs1=mysql_query("select * from user");
    $rs2 = $rs1;
    while ($rsa=mysql_fetch_array($rs1)){
    }
    while ($rsa=mysql_fetch_array($rs2)){
    }试试