I have a database query that utilizes LIMIT 5, so I have 5 results. I want to build them into an array or a string so that I can pull them out later and list them, on a separate page (thus I can't just echo them)... say the variable I pull from the database is "$name" and the results are "Steve", "Mike", "Dave", "Tim", "Bob" and I want either
$string = Steve,Mike,Dave,Tim,Bob;
or
$string[0] = Steve
$string[1] = Mike
$string[2] = Dave
$string[3] = Tim
$string[4] = Bob
So I use:
while ($row = mysql_fetch_array($names_result)) {
$name = $row["name"];
}
but how do I concat this into a string?
$string .= $name; does not work, I only get the first value like
$string = "Steve";
Help? LOL...