while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Grade_5'] . "</td>";
echo "<td>" . $row['Grade_4'] . "</td>";
echo "<td>" . $row['Grade_3'] . "</td>";
echo "</tr>";
}
is trying to display a row with data elements $row['Grade_5'] (etc) that are not results return from your query.
The rows returned are $row['id'], $row['total'], . . ., $row['P.E_Sub']. For that matter, using a period in a column name is bad practice, at least, and if MS SQL, an error.
My impression is that you cut/pasted this block from somewhere as you don't seem to know how any of it works.
Here's the way to " make the things I want to be in my tables results":
SQL Tutorial[
^] and
PHP 5 Tutorial[
^]