whenever I am running this code
<?php
$db=mysql_connect('localhost','root','');
mysql_select_db('moviesite',$db);
$query= 'SELECT * FROM movie';
$result=mysql_query($query,$db) or die(mysql_error($db));
while ($row=mysql_fetch_assoc($result))
echo '<tr>';
{
foreach ($row as $value) {
echo $value;
}
}
?>
everything ok, properoutput...........
but after that I typed this code of the output in table
<?php
$db=mysql_connect('localhost','root','');
mysql_select_db('moviesite',$db);
$query= 'SELECT * FROM movie';
$result=mysql_query($query,$db) or die(mysql_error($db));
echo '<table border="1">';
while ($row=mysql_fetch_assoc($result))
echo '<tr>';
{
foreach ($row as $value) {
echo '<td >' . $value . '</td>';
}
echo '<tr/>';
}
echo '</table>';
?>
then browser is showing error like this.....
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\movie\fstpage.php on line 12
pls help me. I am a new programmer cant find the solution