<?php
include('../includes/db.php');

$sql = "SELECT * FROM courses ORDER BY id DESC";
$result = mysqli_query($conn, $sql);

while ($row = mysqli_fetch_assoc($result)) {
    echo "<tr>
        <td>{$row['status']}</td>
        <td>{$row['code']}</td>
        <td><a href='#' class='view-course' data-id='{$row['id']}'>{$row['name']}</a></td>
        <td>
            <button class='btn btn-sm btn-warning edit-btn' data-id='{$row['id']}'>Edit</button>
            <button class='btn btn-sm btn-danger delete-btn' data-id='{$row['id']}'>Delete</button>
        </td>
    </tr>";
}
?>
