Ok, lets see who can understand what I am saying.....
I have 2 tables to pull some data from: Reports, and Judges
The reports table simple holds the reports from a bunch of students, while seven judges grade each report on a scale from 1-7 in three categories. So, a report can get a high score of 21.
My dilemma is to pull all the reports and show them on one single page - while producing a total sum of each category(from the judges scores) and the total sum of all categories(by adding all categories together).
I have 4 columns to display:
Report Title, Interest Score, Content Score, Methodology Score, Total Score
The report title is in the reports table, while the scores are in the judges table.
With this I add all the Interest scores for one report and divide it by 7 (number of judges). I do the same thing with Content Score and Methodology score. I then add those 3 category scores together to get the total score for that report.
So now I am having a math issue while querying from two separate tables, but trying to show all reports in a simple while() statement, and including the scores too. I'm not being so successful at it.
<?
$sql = mysql_query("SELECT * FROM reports");
while ($row = mysql_fetch_array($sql)) {
?>
<tr>
<td><?php echo $row['report_title']; ?></td>
<td>Interest sum</td>
<td>Methodology sum</td>
<td>Content sum</td>
<td>total SUM</td>
</tr>
<? } ?>
As you can see, I don't know quite how to pull multiple rows from a different table whose matching column is reports_id.
Anyone understand what I'm trying to accomplish?