mysql_fetch_array 数据指针会下移一条记录...
所以,任何一个OK后,应恢复.而一般的做法是你用一次循环,把结果缓存到一个数组里.

解决方案 »

  1.   

    myfuncitonB($result){
     while($rs=mysql_fetch_array($result)){
       echo $rs['xxx'];
       echo $rs2['xxx'];
     }//第一次}
    写成这样不好吗?
      

  2.   

    myfuncitonB($result){
     $result2 = $result;
     while($rs=mysql_fetch_array($result)){
       echo $rs['xxx'];
     }//第一次 while($rs2=mysql_fetch_array($result2)){
       echo $rs2['xxx'];
     }//第二次}
      

  3.   

    我用了mrshelly(Shelly)的解决办法通过了代码
    myfuncitonB($result){
     while($rs=mysql_fetch_array($result)){
       echo $rs['xxx'];
     }//第一次mysql_data_seek($result,0);//移动这个记录集的指针 从新指向开始位置 while($rs2=mysql_fetch_array($result)){
       echo $rs2['xxx'];
     }//第二次}
      

  4.   

    为提高效率,应该把结果缓存到数组里去.
    myfuncitonB($result){
     $dataCache=array();
     while($rs=mysql_fetch_array($result)){
       $dataCache[]=$rs['xxx'];
     }//第一次 //第一次
      echo implode('',$dataCache);
     //第二次 
      echo implode('',$dataCache);
    }