this function mysql_fetch_array fetch a row, each time you calling it; it depends on the number of rows returned from the query itself.
this line:
$msg[] = $row["name"];
takes the $row array, which is filled with the row's fields (name
is one of them).
The fields are determined by query itself ("select name.."
).
while ($row=mysql_fetch_array($n1)) {
You are actually saying here: as long there are rows to handle, give me the next one
.
The next one is stored in $row
and you handle its fields.
You actually filling an array ($msg
) with the field, so the resulting array will be like this:
$msg[0] = "some name";
$msg[1] = "another name";
...