I have a simple database for hockey stats for my son. I can enter data into the db and pull it back, but I wanted to have points, which is goals + assists, displayed without entering into the DB. I enter both Goals and assists into the database and display that all in a table on the page:
http://hjmoore420.com/hockey_display.php
I added the points in here so I could get around the problem but I want to have the two variable add up to make points as I said above, and then I want another row of totals, goals, assists points at the bottom. I tried a few things and nothing worked, any guidance would be welcome.
Thanks.
$result = mysql_query("SELECT * FROM hockey");
$goals= mysql_query("SELECT goals FROM hockey");
[echo "<table border='1'>]
[<tr>]
[<th>Game</th>]
[<th>Goals</th>]
[<th>Assists</th>]
[<th>Points</th>]
[<th>PIM</th>]
[<th>Plus/ Minus</th>]
[</tr>";]
[while($row = mysql_fetch_array($result))]
{
[echo "<tr>";]
[ echo "<td>" . $row['game'] . "</td>";]
[ echo "<td>" . $row['goals'] . "</td>";]
[echo "<td>" . $row['assists'] . "</td>";]
[echo "<td>" . $row['points'] . "</td>";]
[echo "<td>" . $row['PIM'] . "</td>";]
[echo "<td>" . $row['plus'] . "</td>";]
[ echo "</tr>";]
[ }]
i added the []'s and I am not sure if it mattered or not, theya re not really in my code.