I am trying to output the array $Movies as an HTML table, here's the function;
function print_movies($table= 'Movies'){
$db= $GLOBALS['db'];
$Movies = get_info('Movies');
print_r($Movies);
echo "<table border='1'>
<tr>
<th>Movie Title</th>
<th>Year Released</th>
<th>Was it a book?</th>
<th>Genre</th>
</tr>"
for($i=0;$i<count($Movies);$i++)){
?>
<tr><td><?php echo $Movies[$title]; ?></td>
<tr><td><?php echo $Movies[$year_released]; ?></td>
<tr><td><?php echo $Movies[$is_book]; ?></td>
<tr><td><?php echo $Movies[$genre]; ?></td>
<?php
}
echo "</table>";
?>
}
And here's my HTML;
<?php
print_movies($Movies);
?>
<?php echo $Movies[$i][$title]; ?>
– MonkeyZeus Jan 23 at 22:06</tr>";
– Set Sail Media Jan 23 at 22:06foreach
, it will change your life. – Arian Jan 23 at 22:09