Home >Backend Development >PHP Tutorial >谁能给我详细解释一下这句话的意思

谁能给我详细解释一下这句话的意思

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 08:45:341062browse
while($row=mysql_fetch_assoc($result)):

求详细解释


回复讨论(解决方案)

当执行返回不是一个空结果的时候一直循环.
极少用while 总觉得不好控制

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

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

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

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

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

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




mysql_fetch_assoc 这个函数是什么意思?


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

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

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




mysql_fetch_assoc 这个函数是什么意思?
将结果行以关联数组形式返回

mysql_fetch_assoc 这个函数是什么意思?



官方手册是最好的教程。
http://php.net/manual/zh/function.mysql-fetch-assoc.php
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