对同一个记录集执行2次的问题 mysql_fetch_array 数据指针会下移一条记录...所以,任何一个OK后,应恢复.而一般的做法是你用一次循环,把结果缓存到一个数组里. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 myfuncitonB($result){ while($rs=mysql_fetch_array($result)){ echo $rs['xxx']; echo $rs2['xxx']; }//第一次}写成这样不好吗? myfuncitonB($result){ $result2 = $result; while($rs=mysql_fetch_array($result)){ echo $rs['xxx']; }//第一次 while($rs2=mysql_fetch_array($result2)){ echo $rs2['xxx']; }//第二次} 我用了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']; }//第二次} 为提高效率,应该把结果缓存到数组里去.myfuncitonB($result){ $dataCache=array(); while($rs=mysql_fetch_array($result)){ $dataCache[]=$rs['xxx']; }//第一次 //第一次 echo implode('',$dataCache); //第二次 echo implode('',$dataCache);} php防止刷新提交 php页面里include一个静态页面 下载中文名乱码问题: 求解PHP无法连接mysql问题 在线等 thinkphp如何实现以下需求 紧急求救:mail发送时只发送部分,不能将全部内容发送出去?怎么办? 一个关于phpmyadmin的简单问题 数组变量在""中什么时候可以被辨识? php学员们!加个QQ: 57079524 有谁开发过webmail? 怎么用preg_replace() 草鸟问简单的问题,怎么才能上传flash,我这个只能上传图片,该怎么改呀
while($rs=mysql_fetch_array($result)){
echo $rs['xxx'];
echo $rs2['xxx'];
}//第一次}
写成这样不好吗?
$result2 = $result;
while($rs=mysql_fetch_array($result)){
echo $rs['xxx'];
}//第一次 while($rs2=mysql_fetch_array($result2)){
echo $rs2['xxx'];
}//第二次}
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'];
}//第二次}
myfuncitonB($result){
$dataCache=array();
while($rs=mysql_fetch_array($result)){
$dataCache[]=$rs['xxx'];
}//第一次 //第一次
echo implode('',$dataCache);
//第二次
echo implode('',$dataCache);
}