How to use foreach to display data from multiple column?
Hi..guys! I have a form and use foreach to output value from multiple column in database.What wrong went in the following script?I can only get the movie name but not category as well.How about if category likely to be bracketed?
PHP Code:
<tr>
<td>
<?
if (isset($_SESSION['gmemberid'])) {
$tbl_name = "movie";
$result = mysql_query("SELECT name,category FROM $tbl_name")
or die("Cannot execute query.");
$numrow = mysql_num_rows($result);
if ($numrow != 0) {
for ($counter = 0; $row = mysql_fetch_row($result); $counter++) {
foreach ($row as $key => $value) {
if ($key == 0) {
?>
<strong><br>
<?php echo $value;?></strong></font></td>
</tr>
<?
}
}
}
}
}
?>