if ($rs_row=mssql_fetch_array($rs)){
$i=0;
$strResult= " <tr height=30> <th>序号 </th> <th>编码 </th> <th>名称 </th> </tr>";
do {
$strResult= $strResult."<tr height=25 ><td align=center>".$rs_row[0]."</td><td class=border1 align=left>".$rs_row[1]."</td><td align=left>".$rs_row[2]."</td></tr>"; $i++;
}while($rs_row=mssql_fetch_array($rs));
}读出来却是从第二条记录开始显示的,i已经是0了,为什么读不到第一条记录呢?
$i=0;
$strResult= " <tr height=30> <th>序号 </th> <th>编码 </th> <th>名称 </th> </tr>";
do {
$strResult= $strResult."<tr height=25 ><td align=center>".$rs_row[0]."</td><td class=border1 align=left>".$rs_row[1]."</td><td align=left>".$rs_row[2]."</td></tr>"; $i++;
}while($rs_row=mssql_fetch_array($rs));
}读出来却是从第二条记录开始显示的,i已经是0了,为什么读不到第一条记录呢?
if ($rs_row=mssql_fetch_array($rs)){
$i=0;
$strResult= " <tr height=30> <th>序号 </th> <th>编码 </th> <th>名称 </th> </tr>";
while($rs_row=mssql_fetch_array($rs)) { $strResult= $strResult." <tr height=25 > <td align=center>".$rs_row[0]." </td> <td class=border1 align=left>".$rs_row[1]." </td> <td align=left>".$rs_row[2]." </td> </tr>"; $i++;
};
}
$rs_row=mssql_fetch_array($rs)读取了两次。(不理睬do while的执行顺序)$i=0;
$strResult=" <tr height=30> <th>序号 </th> <th>编码 </th> <th>名称 </th> </tr>";
while($rs_row=mssql_fetch_array($rs))
{
$strResult= $strResult." <tr height=25 > <td align=center>".$rs_row[0]." </td> <td class=border1 align=left>".$rs_row[1]." </td> <td align=left>".$rs_row[2]." </td> </tr>";
$i++;
}