Jump to content

Mike

Members
  • Posts

    2
  • Joined

  • Last visited

Mike's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. hi, I dont understand what you mean?
  2. I wish to evaluate the tototal/sum of the sum column in the <tfoot> section of my table. I can't get the output correctly. my code is below. I shall appreciate any inputs. Take a look at the attached screen capture to better understand what i need to do. The total of the sum column in the table <tfoot> is what i need: <?phprequire_once('includes/connect.php');$result = mysqli_query($con, "SELECT studentid, hw1, hw2, hw3, SUM(hw1+hw2+hw3) as sum FROM scores GROUP BY studentid");echo "<table border='1'><thead> <tr> <th>StudentID</th> <th>HW1</th> <th>HW2</th> <th>HW3</th> <th>SUM</th> </tr></thead>";echo "<tfoot> <tr> <td>Total:</td> <td> echo SUM(sum);</td> </tr></tfoot>";while ($row = mysqli_fetch_array($result)){"<tbody> <tr>"; echo "<td>" . $row['studentid'] . "</td>"; echo "<td>" . $row['hw1'] . "</td>"; echo "<td>" . $row['hw2'] . "</td>"; echo "<td>" . $row['hw3'] . "</td>"; echo "<td>" . $row['sum'] . "</td>"; echo " </tr> </tbody>"; } echo "</table>"; mysqli_close($con);?> Thanks
×
×
  • Create New...