i have a problem with this code amay any one help me am doing a class project but stuck here is the code its bring an error
Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in C:\wamp\www\kawempe_HC\staf.php on line 7
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\wamp\www\kawempe_HC\staf.php on line 16
<?php
$query="select * from staff";
$result=mysql_query($query);
echo "<table border=1>";
echo "<tr>";
for($i=0;$i<mysql_num_fields($result);$i++)
{
echo "<th>";
echo mysql_field_name($result, $i);
echo "</th>";
}
while($row=mysql_fetch_row($result))
{
echo "<tr>";
for($j=0;$j<$i;$j++)
{
echo "<td>";
echo $row[$j];
echo "</td>";
}
echo "</tr>";
}
echo "</tr>";
echo "</table>";
?>