waynem801 Posted August 23, 2007 Share Posted August 23, 2007 Ok, so i've gotten this far, i've been able to display the record set "SCORE" in a table.. Here's my problem, I want to be able to add the Numeric values of all the record set. Example: "Score" 1 5 9 10 3 etc..... The total of this = 28... So how do i get php to add the data in the record? Thanks, Wayne $con = mysql_connect("#########", ######", "#########"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("######", $con); $result = mysql_query("SELECT * FROM #######); echo "<table border='1'> <tr> <th>score</th> <th>course rating</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>". $row['score']."</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted August 24, 2007 Share Posted August 24, 2007 try to use the sum function in mysql....but u nid to use the group by function also... select sum(Score) from ##### group by common field to all scores u nid to add Quote Link to comment Share on other sites More sharing options...
waynem801 Posted August 24, 2007 Author Share Posted August 24, 2007 pefect thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.