HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux host 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: w230 (1248)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/w230/html/behavior/summary.php
<?php include 'db.php'; ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>สรุปคะแนนรายคน</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css2?family=Prompt&display=swap" rel="stylesheet">
</head>
<body style="font-family: 'Prompt', sans-serif;">
<div class="container mt-5">
  <h3>สรุปคะแนนความประพฤติรายคน</h3>
  <table class="table table-bordered">
    <thead>
      <tr><th>ชื่อนักเรียน</th><th>คะแนนที่ถูกตัดรวม</th></tr>
    </thead>
    <tbody>
      <?php
      $sql = "SELECT student_name, SUM(points) as total FROM behaviors GROUP BY student_name";
      $result = mysqli_query($conn, $sql);
      while ($row = mysqli_fetch_assoc($result)) {
        echo "<tr><td>{$row['student_name']}</td><td>{$row['total']}</td></tr>";
      }
      ?>
    </tbody>
  </table>
</div>
</body>
</html>