Heim  >  Artikel  >  Backend-Entwicklung  >  哪位高手能给小弟我详细解释一下这句话的意思

哪位高手能给小弟我详细解释一下这句话的意思

WBOY
WBOYOriginal
2016-06-13 12:15:44846Durchsuche

谁能给我详细解释一下这句话的意思
while($row=mysql_fetch_assoc($result)):

求详细解释
------解决思路----------------------
1.while(condition)  {dosomething();} condition = true时dosomething()一直执行,否则跳出循环.
2.$row=mysql_fetch_assoc($result) 赋值,没有更多行时返回false

综上,在数据库没有数据之前会一直执行dosomething();的内容.

另外,貌似现在php已经不推荐用mysql_fetch_assoc()这个函数了可以考虑试用mysqli或者pdo替换
------解决思路----------------------

引用:
mysql_fetch_assoc 这个函数是什么意思?


官方手册是最好的教程。
http://php.net/manual/zh/function.mysql-fetch-assoc.php
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn