Who can explain the meaning of this sentence in detail?
While ($ row = mysql_fetch_assoc ($ result )):
Explanation
Reply to discussion (solution)
When the execution returns a result that is not empty, the loop continues.
It is difficult to control the use of while.
1. while (condition) {dosomething ();} when condition = true, dosomething () is always executed; otherwise, the loop is jumped out.
2. $ row = mysql_fetch_assoc ($ result) value assignment. If no more rows exist, false is returned.
In summary, dosomething (); is always executed before the database has no data.
In addition, it seems that mysql_fetch_assoc () is not recommended for php now. you can try to replace mysqli or pdo.
1. while (condition) {dosomething ();} when condition = true, dosomething () is always executed; otherwise, the loop is jumped out.
2. $ row = mysql_fetch_assoc ($ result) value assignment. If no more rows exist, false is returned.
In summary, dosomething (); is always executed before the database has no data.
In addition, it seems that mysql_fetch_assoc () is not recommended for php now. you can try to replace mysqli or pdo.
What does mysql_fetch_assoc mean?
1. while (condition) {dosomething ();} when condition = true, dosomething () is always executed; otherwise, the loop is jumped out.
2. $ row = mysql_fetch_assoc ($ result) value assignment. If no more rows exist, false is returned.
In summary, dosomething (); is always executed before the database has no data.
In addition, it seems that mysql_fetch_assoc () is not recommended for php now. you can try to replace mysqli or pdo.
What does mysql_fetch_assoc mean?
Returns the result row as an array.
What does mysql_fetch_assoc mean?
The official manual is the best tutorial.
Http://php.net/manual/zh/function.mysql-fetch-assoc.php