Someone please help me with this loop. It is only displaying and printing the first filename when I need it to print and display all filenames.
extract($_POST);
$query = "SELECT yr_left, city_origin, country_origin, yr_arrival, city_arrival, state_arrival FROM story WHERE country_origin = '$search_country' AND pamapproved = 'Y' ORDER BY yr_left";
$result = mysql_query($query);
$query2 = "SELECT filename FROM story WHERE country_origin = '$search_country' AND pamapproved = 'Y' ORDER BY yr_left";
$result2 = mysql_query($query2);
print "<tr height = '15%'>";
print "<th class='theader'>File</th>";
print "<th class='theader'>Year Left</th>";
print "<th class='theader'>City Origin</th>";
print "<th class='theader'>Country Origin</th>";
print "<th class='theader'>Year Arrived</th>";
print "<th class='theader'>City Arrived</th>";
print "<th class='theader'>State Arrived</th></tr>";
while($row = mysql_fetch_array($result2))
{
while($column = mysql_fetch_object($result))
{
foreach($file as $filename)
{
print "<tr height = '30%'>";
print "<td><input type = 'button' name = 'file' value = '$filename' </td>";
}
foreach($column as $colval)
{
print "<td class = 'tdata'>$colval</td>";
}
print "</tr>";
}
}
print "</table>";
mysql_free_result($result);
mysql_free_result($result2);
mysql_close();
?>