<?php
include 'db.php';

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=registration_report.xls");

echo "<table border='1'>";
echo "<tr><th>Full Name</th><th>Mobile</th><th>Email</th><th>Place</th></tr>";

$result = $conn->query("SELECT fullname, mobileno, email, place FROM usermaster ORDER BY id DESC");

while ($row = $result->fetch_assoc()) {
    echo "<tr>
            <td>".htmlspecialchars($row['fullname'])."</td>
            <td>".htmlspecialchars($row['mobileno'])."</td>
            <td>".htmlspecialchars($row['email'])."</td>
            <td>".htmlspecialchars($row['place'])."</td>
          </tr>";
}
echo "</table>";
?>
