๐ File Manager
๐ /
/
home
/
u857492117
/
domains
/
mangaldaicollege.org
/
public_html
/
Automation
Dosya Dรผzenle: semester_report.php
<?php include 'connect.php'; $query = " SELECT b.student_name, MIN(s.Sroll) as Sroll, CASE WHEN MIN(s.Sroll) LIKE '23%' THEN '6th Sem' WHEN MIN(s.Sroll) LIKE '24%' THEN '4th Sem' WHEN MIN(s.Sroll) LIKE '25%' THEN '2nd Sem' END AS semester FROM bookings b JOIN student s ON TRIM(LOWER(b.student_name)) = TRIM(LOWER(s.Sname)) WHERE s.Sroll LIKE '23%' OR s.Sroll LIKE '24%' OR s.Sroll LIKE '25%' GROUP BY b.student_name "; $result = mysqli_query($con, $query); // counters $count = [ "2nd Sem" => 0, "4th Sem" => 0, "6th Sem" => 0 ]; $rows = []; while ($row = mysqli_fetch_assoc($result)) { $rows[] = $row; $count[$row['semester']]++; } $grand_total = array_sum($count); ?> <!DOCTYPE html> <html> <head> <title>Final Semester Report</title> <style> body { font-family: Arial; background:#f4f4f4; padding:10px; } h2 { text-align:center; } table { border-collapse: collapse; width:100%; background:#fff; } th, td { border:1px solid #ccc; padding:10px; text-align:center; } th { background:#333; color:white; } .summary { margin-top:15px; background:#fff; padding:10px; border:1px solid #ccc; } </style> </head> <body> <h2>๐ Final Semester Report (No Duplicates)</h2> <table> <tr> <th>Name</th> <th>Roll No</th> <th>Semester</th> </tr> <?php foreach ($rows as $r) { ?> <tr> <td><?= $r['student_name'] ?></td> <td><?= $r['Sroll'] ?></td> <td><?= $r['semester'] ?></td> </tr> <?php } ?> </table> <div class="summary"> <p>๐ 2nd Sem: <?= $count['2nd Sem'] ?></p> <p>๐ 4th Sem: <?= $count['4th Sem'] ?></p> <p>๐ 6th Sem: <?= $count['6th Sem'] ?></p> <p style="color:green;">โ Grand Total: <?= $grand_total ?></p> </div> </body> </html>
๐พ Kaydet
ฤฐptal