Maison >développement back-end >tutoriel php >while遍历结果集解决思路
while遍历结果集
for遍历。
$num=mysql_num_rows($result);<br />for($i=0;$i<$num;$i++)<br />{<br /> $row=mysql_fetch_assoc($result);<br /> $arr[]=$row;<br />}
while($row=mysql_fetch_assoc($result)){<br /> $arr[]=$row;<br />}