Home  >  Article  >  Backend Development  >  while遍历结果集解决思路

while遍历结果集解决思路

WBOY
WBOYOriginal
2016-06-13 12:58:25933browse

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的条件怎么填- -。 貌似我好像见过。貌似忘了。
------解决方案--------------------
while($row=mysql_fetch_assoc($result)){<br />
  $arr[]=$row;<br />
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn