I have a fairly simple MySQL database at present. Clearly each field in each records has a name.
I then have a tiny php script to deliver a webpage
<?php
include_once 'includes/dbh.inc.php';
?>
<! DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
$sql="SELECT * FROM income_tax;";
$result=mysqli_query($conn,$sql);
$resultCheck=mysqli_num_rows($result);
if ($resultCheck>0) {
echo "<table border ='1')>";
echo "<tr>";
echo "<td>".Year."</td>";
echo "<td>".BRB."</td>";
echo "<td>".BR."</td>";
echo "<td>".HRB."</td>";
echo "<td>".HR."</td>";
echo "<td>".S_BR."</td>";
echo "</tr>";
while ($row=mysqli_fetch_assoc($result)){ // any way to simply rad through all fields?
echo "<tr>";
echo "<td>".$row['year']."</td>";
echo "<td>".$row['BRB']."</td>";
echo "<td>".$row['BR']."</td>";
echo "<td>".$row['HRB']."</td>";
echo "<td>".$row['HR']."</td>";
echo "<td>".$row['S_BR']."</td>";
echo "</tr>";
}
echo "</table>";
}
?>
</body>
</html>
The database is about to get a lot bigger. What I would like to do,m instead of putting in the header rows in the table manually, is to read the names of the fields into it. As I am a total newbie to php I have no idea how to do it. Can anyone help out?
TIA