I am confused about the use of the foreach loop described in the movie.php file in chapter 6:
PHP Code:
//populate the select options with the results
while ($row = mysql_fetch_assoc($result)) {
foreach ($row as $value) {
echo '<option value="' . $row['movietype_id'] . '">';
echo $row['movietype_label'] . '</option>';
}
}
Why are we using a foreach loop? We are assigning values to $value and then not calling the variable in the loop; we end up calling the specific $row array values instead... this just causes everything to be repeated twice in the drop down menu.
Is this a mistake?
Thanks in advance for the help...
-Kent