为什么我只获得1行ans?

while($row = mysql_fetch_array($result)) { if (isset($row["name"]) && ($row["name"] != "")){ $contentStr = $row["name"]; } break; } mysql_close($con);

This works but not the way i want. I want to show all the data that i get from. Example in got 4 data now on database and using for the next line to show another data. How to write the format ?

Firstly, remove the break. It is serving no purpose.

Now, I believe what you want to do is obtain all the row["name"] values into one String, namely $contentStr, separated by a newline.

If this is the case, use the following:

$contentStr .= $row["name"] . "
"

Also, make sure to create an empty $contentStr before the loop.