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); Link to comment https://forums.phpfreaks.com/topic/66417-solved-ive-got-a-recordset-i-would-like-to-add-the-numeric-values-of-help/ 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 Link to comment https://forums.phpfreaks.com/topic/66417-solved-ive-got-a-recordset-i-would-like-to-add-the-numeric-values-of-help/#findComment-332616 Share on other sites More sharing options...
waynem801 Posted August 24, 2007 Author Share Posted August 24, 2007 pefect thank you Link to comment https://forums.phpfreaks.com/topic/66417-solved-ive-got-a-recordset-i-would-like-to-add-the-numeric-values-of-help/#findComment-332725 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.