I am trying to pull information from a database within a while loop. I want a certain variable ($var) to be added to itself everytime the loop is processed. Example is the value of $var is "hello" the first time and "goodbye" the second time. I want a new variable ($varlist) that I can call from outside the loop to be "hello, goodbye". How would I go about doing this?
Sample Code:
$query = "select * from subscribervars where username='$username' order by id ASC";
$result = mysql_query($query) or die("Couldn't execute query");
while ($row = @mysql_fetch_array($result)) {
$var = $row["var"];
//this is where I am missing the definition of $varlist
$count++ ;}
echo $varlist;
$query = "INSERT INTO $username ($varslist) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')";
}