I'm sure this has been answered a million times before, but I can't seem to find a clear concinse answer.
I need to do two things.
First I need to get the results from a mysql database and add them together. Example: I need to retrieve the credit worth of several courses a student has taken.
Here is the code I have been trying to use:
$getcredits = mysql_query("SELECT credit FROM courseactivity WHERE sid='$sid' GROUP BY grade");
$creditsarray = mysql_fetch_array($getcredits);
$totalcredits = array_sum($creditsarray);
echo "total: ".$totalcredits;
The next thing I need to do is take all of the grades the student has gotten and get the average.