I am trying to view all the values of a certain field as long as the username='entered username'
. My problem is that I can only do this in a while loop and print out the result within the while loop, so I can't use the results outside the while loop. Is there any other way to do this? Here is my current code.
$query = mysql_query("SELECT * FROM databse WHERE username='$username'");
$numrows = mysql_num_rows($query);
while ($row = mysql_fetch_assoc($query)){
$message= $row['message'];
print_r ($message);
}
mysql_close();