$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 ,该如何写了?
就是说,我从头到尾读取了一次表记录,我还想再读取一边该如何写?
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 ,该如何写了?
就是说,我从头到尾读取了一次表记录,我还想再读取一边该如何写?
跳过第一条?
再读取一遍这种需求很奇怪 说说你到底想干嘛 在读一遍不是没有办法 但是一般需求用不到
就是移动到记录集的第一条,以便第二个while的条件不为false
while ($rsa=mysql_fetch_row($rs)){
$rs2 = $rs1;
while ($rsa=mysql_fetch_array($rs1)){
}
while ($rsa=mysql_fetch_array($rs2)){
}试试