![]() |
mperry622 3/23/2015 |
I need to sum total hrs for set of classes. I have 3 tables conference attendees, class list, with hrs per class, and class attendees. I simply want to total the class attendees hrs spent in all of the classes they go to attendee ID 45 goes to class 1 3.75 hrs class 2 4.25 hrs Total hrs for attendee ID 45 is 8.0 hrs I want to total these and have it edit/update a field in the table conference attendees - attendee ID 45 I found this on another post but I'm not sure what to do with it __ global $conn; $sql = "select hrs from class_attendees where id='".postvalue("editid1")."'"; $rs = db_query($sql,$conn); $data = db_fetch_array($rs); if(!$data) return; echo "<table>"; while(1) { echo "<tr>"; foreach($data as $v) { echo "<td>"; echo htmlspecialchars($v); echo "</td>"; } echo "</tr>"; if(!($data = db_fetch_array($rs))) break; } echo "</table>";
|
|
501414 3/23/2015 |
Thank you Mikeperry for the help. |
![]() |
HJB 3/23/2015 |
Adding single values to totals per attendee ID is usually an ideal job for the built-in report tool where you can fine-tune searches on per ID basis via advanced search function with ease. This would totally free you from manual coding issues and would deliver the wished result via onboard report feature. Finally I guess that the report option CROSS-TAB INDEXED would perfectly fit to your need while the LIST VIEW one with cumulative results could do fine as well. |